I'm using the cakePHP email component for sending mails from my application. Now the return-path has something like www@domain.tld
How can I set or rewrite the Return-Path value in emails when using the cakePHP Component?
I know how to do it when sending mails via 'mail' in PHP but the cakePHP email component seems to missing such a feature... or am I missing something? :)
Digging into the cake manual when you were looking at how to use the rest of the component you should have seen something like the following. This is what set the Return-Path.
$this->Email->return = 'name@tld.com';
To change the return path in CakePHP Email component I do like this:
and it works like charm ;)
There's an attribute called EmailComponent::return that is the return path for error messages. Note that this is different than the replyTo attribute.
http://book.cakephp.org/1.3/en/The-Manual/Core-Components/Email.html
In CakePHP 2 (where the Email Component is largely replaced by the CakeEmail class), you can do this configuration inside /app/Config/email.php:
Or if you need to do it just for a single email, something like this should work...
A co-worker and I were working on this same issue, we found that editing the following line in php.ini gave us our fix:
from:
to:
when testing be sure to send your emails to a valid domain. this caught us for a few minutes.