在cPanel Webmail sent文件夹中存储CakePHP SMTP电子邮件副本
我使用CakeEmail通过CakePHP应用程序向用户发送电子邮件。我使用以下代码发送电子邮件:在cPanel Webmail sent文件夹中存储CakePHP SMTP电子邮件副本,php,email,cakephp,cpanel,Php,Email,Cakephp,Cpanel,我使用CakeEmail通过CakePHP应用程序向用户发送电子邮件。我使用以下代码发送电子邮件: $this->Email->smtpOptions = array( 'port'=>'465', 'timeout'=>'30', 'host' => 'ssl://*************',
$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.'));
}
$this->Email->smtpOptions=array(
“端口”=>“465”,
“超时”=>“30”,
'主机'=>'ssl://************',
“用户名”=>“*************”,
“密码”=>“***********”
);
$this->Email->delivery='smtp';
$this->Email->from='************';
$this->Email->attachments=array(getcwd().$filename);
$this->Email->to='***************';
$this->Email->subject='Purchase Order(M/s..$party\u name.')采购订单编号.日期($last\u id['PO']['id']+1);
$this->Email->sendAs='both';
试一试{
如果($this->Email->send('尊敬的先生,
请在附件中找到P.O.,并注意请将P.O.与您的账单一起附上。
谢谢您,
')){
//成功
$this->Flash->success(_uu('采购订单已保存,电子邮件已成功发送');
}否则{
//失败,没有任何例外
$this->Flash->error(_uu('采购订单已保存,未发送电子邮件');
}
}捕获(例外$e){
//失败,例外
$this->Flash->error(_uu('采购订单已保存,未发送电子邮件');
}
它工作正常,但不会将电子邮件副本存储在cPanel Sent文件夹中
研究后我认为它不会保存以编程方式发送的电子邮件,请尝试连接到服务器,并将其保存到sent文件夹。@Mr.Phoenix知道如何在服务器上保存。由于您有cpanel,可能有一个配置选项来保存发送的电子邮件,否则请查看IMAP和
APPEND