我正在使用CakeEmail通过CakePHP应用程序向用户发送电子邮件。我用以下代码发送电子邮件:
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'host' => 'ssl://*************',
'username'=>'***************',
'password'=>'***********'
);
$this->Email->delivery = 'smtp';
$this->Email->from = '***********';
$this->Email->attachments =array(getcwd().$filename);
$this->Email->to = '*************';
$this->Email->subject = 'Purchase Order (M/s.'.$party_name.') PO No. '.date('Y/m/').($last_id['Po']['id']+1);
$this->Email->sendAs = 'both';
try {
if ($this->Email->send('Respected Sir,<br><br>Please find P.O. in the attachment and also note please attach P.O. with your bill.<br><br>Thanking You<br><b>')) {
// Success
$this->Flash->success(__('The po has been saved and email sent successfully.'));
} else {
// Failure, without any exceptions
$this->Flash->error(__('The po has been saved and email not sent.'));
}
} catch ( Exception $e ) {
// Failure, with exception
$this->Flash->error(__('The po has been saved and email not sent.'));
}
它工作正常,但不会在cPanel Sent文件夹中存储电子邮件副本。
研究后