1
我使用CakePHP 2.2cakeemail和gmail smtp如何更改FROM字段?
這是我的SMTP設置在配置/ email.php
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => '[email protected]',
'password' => 'somepassword',
'transport' => 'Smtp'
);
這是我的電子郵件設置。
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('gmail');
$email->from(array('[email protected]' => 'On Behalf of Big Shot'));
$email->to('[email protected]');
$email->subject('[Test -- please ignore] one last test. Remember to hit REPLY to this email');
$email->sender('[email protected]');
$email->replyTo('[email protected]', 'Big Shot');
$email->send('Remember to hit REPLY to this email');
當發送電子郵件,發件人地址顯示反覆
On Behalf of Big Shot<[email protected]>
我怎麼可以把它使得FROM出現[email protected]的原始電子郵件地址?
順便說一句,replyTo工作得很好。
我正在嘗試完善郵件投遞。
這完全有道理!所以請始終使用ReplyTo作爲您的原始電子郵件地址。 – mark