【发布时间】:2018-10-18 14:33:24
【问题描述】:
<?php
include 'vendor/autoload.php';
//Setup host and Port
$transport = (new Swift_SmtpTransport('smtp.gmail.com',465,'ssl'))
->setUsername('any@any.com')
->setPassword('any')
;
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Test Subject'))
->setFrom(['estesys53@gmail.com' => 'JSebastian Smith'])
->setTo(['any@gmail.com', 'any@any.com',
's.any@stu.any.edu' => 'Sebastian'])
->setBody('Here is the test message itself')
;
// Send the message
$result = $mailer->send($message);
?>
我的代码工作正常,但一次将所有电子邮件发送到 ->setto 变量中提供的地址。我需要设置一个循环来延迟每 7 秒发送一封电子邮件。
【问题讨论】:
-
你尝试过循环吗?
-
所以当您拥有超过一定数量的电子邮件地址时,您的客户端会超时吗?你确定php是你想走的路吗?
-
@Archer 这可以是控制台脚本,不一定是网络脚本
-
@Cid 是的,这就是我问 OP 这个问题的原因。
-
我被客户端强制使用 PHP,但是我是语言新手 :)
标签: php swiftmailer