lor*_*key 9 email cakephp return-path
我正在使用cakePHP电子邮件组件从我的应用程序发送邮件.现在返回路径有类似www@domain.tld的东西
使用cakePHP组件时,如何设置或重写电子邮件中的Return-Path值?
我知道如何在PHP中通过'mail'发送邮件时这样做但是cakePHP电子邮件组件似乎缺少这样的功能......或者我错过了什么?:)
在CakePHP 2中(其中Email Component很大程度上由CakeEmail类替换),您可以在/app/Config/email.php中执行此配置:
class EmailConfig {
public $email = array(
...
// The next line attempts to create a 'Return-path' header
'returnPath' => 'myaddress@mydomain.com',
// But in some sendmail configurations (esp. on cPanel)
// you have to pass the -f parameter to sendmail, like this
'additionalParameters' => '-fmyaddress@mydomain.com',
...
);
}
Run Code Online (Sandbox Code Playgroud)
或者,如果你只需要为一封电子邮件做这件事,这样的事情应该有效......
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('MyConfig');
$email->from(...)
->to(...)
->subject(...)
->returnPath('myaddress@mydomain.com')
// Haven't tested this next line, but may possibly work?
->config(array('additionalParameters' => '-fmyaddress@mydomain.com'))
->send();
Run Code Online (Sandbox Code Playgroud)
有一个名为 EmailComponent::return 的属性,它是错误消息的返回路径。请注意,这与replyTo 属性不同。
$this->Email->return = 'name@example.com';
Run Code Online (Sandbox Code Playgroud)
http://book.cakephp.org/1.3/en/The-Manual/Core-Components/Email.html
| 归档时间: |
|
| 查看次数: |
4353 次 |
| 最近记录: |