【问题标题】:batch email send with response批量发送电子邮件并回复
【发布时间】:2010-07-18 20:10:49
【问题描述】:

我想使用 SwiftMail 或任何类似系统发送批量邮件。 SwiftMailer 文档指出:

“邮件的每个收件人都会收到一份不同的副本,收件人:字段中只有他们自己的电子邮件地址。返回一个整数,其中包括成功收件人的数量。”

http://swiftmailer.org/docs/batchsend-method

我想知道是否可以找出哪些电子邮件地址失败,并可选择获取错误原因/代码。

【问题讨论】:

    标签: phpmailer mailing-list swiftmailer


    【解决方案1】:

    那里的说明中有另一个页面讨论了batchsend()失败http://swiftmailer.org/docs/finding-failures,还有一个example我怀疑batchsend将以完全相同的方式完成。。 p>

    $mailer = Swift_Mailer::newInstance( ... );
    
    $message = Swift_Message::newInstance( ... )
      ->setFrom( ... )
      ->setTo(array(
        'receiver@bad-domain.org' => 'Receiver Name',
        'other@domain.org' => 'A name',
        'other-receiver@bad-domain.org' => 'Other Name'
      ))
      ->setBody( ... )
      ;
    
    //Pass a variable name to the send() method
    if (!$mailer->send($message, $failures))
    {
      echo "Failures:";
      print_r($failures);
    }
    
    /*
    Failures:
    Array (
      0 => receiver@bad-domain.org,
      1 => other-receiver@bad-domain.org
    )
    */
    

    【讨论】:

    • 我明白了。所以我不认为它可以返回失败的原因?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-08
    • 2014-08-19
    • 2018-09-29
    • 2016-04-04
    相关资源
    最近更新 更多