小编rog*_*erb的帖子

通过PhpMailer异步发送电子邮件

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

我正在使用PhpMailer,如本例所示https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps

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

mail($to, $subject, $message, $headers, 'O DeliveryMode=b');
Run Code Online (Sandbox Code Playgroud)

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

编辑: - (附加信息)好像PhpMailer可以配置为使用sendmail - https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php 因此我想知道这是否可以某种方式利用启用背景交付.

/**
 * 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 …
Run Code Online (Sandbox Code Playgroud)

php email asynchronous phpmailer

6
推荐指数
1
解决办法
6997
查看次数

标签 统计

asynchronous ×1

email ×1

php ×1

phpmailer ×1