1
I have the following case: I want to send an email from cakephp, but since there is more than one user in the database (each containing a different email), I need to send each user’s email and password to the /app/Config/email.php file, that is, just pick up from the session. There is already a method that captures the user’s data, being $this->Session->read('Usuariologado'), thus being able to pass the rest of the parameters: $this->Session->read('Usuariologado')['User']['email'] and $this->Session->read('Usuariologado')['User']['password']but when trying to pass these session values to the email.php file, it gives an error saying that it is necessary to use this within a function.
email php.:
public $smtp = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'from' => array($_SESSION['UsuarioLogado']['User']['email'] => $_SESSION['UsuarioLogado']['User']['nome']),
'username' => $_SESSION['UsuarioLogado']['User']['email'],
'password' => $_SESSION['UsuarioLogado']['User']['senha'],
'transport' => 'Smtp',
'tls' => false // As of 2.3.0 you can also enable TLS SMTP
);
Just missed the 'from' field, the rest is all right.. I found it strange not to have something similar in the manual (http://book.cakephp.org/2.0/en/core-utility-libraries/email.html).. Thanks
– Julyano Felipe