php异步邮件,通过PhpMailer异步发送电子邮件

我正在使用

PHPMailer发送效果很好的电子邮件.但问题是,由于它同步发送电子邮件,后续页面加载需要很长时间.

我想知道是否有办法使电子邮件传递异步.我对此进行了研究,发现sendmail可以选择将DeliveryMode设置为“后台模式” – 来源http://php.net/manual/en/function.mail.php

mail($to, $subject, $message, $headers, 'O DeliveryMode=b');

我想知道在PhpMailer中是否可以做类似的事情?有人有这个成功吗?

/**

* Which method to use to send mail.

* Options: "mail", "sendmail", or "smtp".

* @type string

*/

public $Mailer = 'mail';

/**

* The path to the sendmail program.

* @type string

*/

public $Sendmail = '/usr/sbin/sendmail';

/**

* Whether mail() uses a fully sendmail-compatible MTA.

* One which supports sendmail's "-oi -f" options.

* @type boolean

*/

public $UseSendmailOptions = true;

/**

* Send messages using $Sendmail.

* @return void

*/

public function isSendmail()

{

$ini_sendmail_path = ini_get('sendmail_path');

if (!stristr($ini_sendmail_path, 'sendmail')) {

$this->Sendmail = '/usr/sbin/sendmail';

} else {

$this->Sendmail = $ini_sendmail_path;

}

$this->Mailer = 'sendmail';

}

我更喜欢这样做作为api调用vs php.ini的内联参数,所以这不是一个全局变化.有没人试过这个?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值