I can send an email via cakephp 1.3. What I cannot seem to do is change the “from” portion – so!
Given:
$this->Email->from = "no-reply@someurl.com";
//OR
$this->Email->from = "no-reply<no-reply@someurl.com>";
...
$this->Email->send();
...
this doesn’t work. Sending to gmail just has a fun “unknown user” value as the “from” or “sender”.
To be clear, I have only one of those $this->Email->from lines, not both!
In the end, I had to go to the email.ctp component in cakephp – cake/libs/controller/component/email.ctp – and change the line 543 from:
$headers[‘From’] = $this->_formatAddress($this->from);
to:
$headers[‘From’] = ‘no-reply’;
Any ideas why i has to do all this? I read online about the aliases file and some sort of setting in the php.ini – i’m running ubuntu 10.04 – but i didn’t touch them.
Actually, if anyone knows what I would do with the /etc/aliases file, or what to do with the php.ini file, that would also be awesome.
cheers!
PS note in the above that my email component is defined as:
'Email' => array (
"delivery"=>"mail",
)
Your first example should work. However, the second is not up to the RFC standard. You need the all important space.
Check the Cake Book form more detail on the Email component.