如何使用Codeigniter为smtp身份验证的电子邮件设置返回路径?

时间:2015-05-04 11:17:12

标签: php codeigniter email bounce smtp-auth

我在codeigniter下面有以下代码,

$config['mailtype'] ='html';
$config['charset'] = 'iso-8859-1';
$config['protocol'] ='smtp';
$config['smtp_host'] ='mail.DomainName';
$config['smtp_user'] = "UserEmailId";
$config['smtp_pass'] = "UserPassword";
$config['smtp_port'] ='25';
$this->email->clear(TRUE);

$this->email->initialize($config);
$this->email->from($fromemail, $fromname);
$this->email->to( $email_to );
$this->email->return_path("BouceEmailId"); // I have made this function in system/library/email.php. Also changed the mail() -f field from _headers['from'] to _headers['return-path']

$this->email->subject( "Subject" );
$this->email->message( "This is test email" );

$this->email->send();

在上面的代码中,它发送了一封电子邮件。但它删除了我设置的返回路径,它只是用from地址替换它。 我已经阅读了一些文章,其中说SMTP在传递时设置了返回路径。

如何在使用SMTP身份验证时设置返回路径?

SMTP不允许为退回的电子邮件设置自定义return_path。它会在传递时自动设置return_path和地址。

0 个答案:

没有答案