【问题标题】:Adding Multiple Recipients with Zend_Mail使用 Zend_Mail 添加多个收件人
【发布时间】:2014-01-24 07:28:39
【问题描述】:

使用 Zend_Mail (Zend v1.12),有没有办法配置 Zend_Mail 对象以便向每个收件人发送自己的邮件副本?看起来最好的答案是在一组收件人上使用 foreach,在每次迭代中清除收件人,然后每次发送......

参考资料: http://framework.zend.com/manual/1.12/en/zend.mail.adding-recipients.html http://framework.zend.com/manual/1.12/en/zend.mail.multiple-emails.html

【问题讨论】:

    标签: php email zend-framework


    【解决方案1】:

    Zend_Mail::addBcc() 和 Zend_Mail::addCc() 可以接收单个电子邮件或一组电子邮件。

    addBcc(array(email@one.com, email@two.com));
    addCc(array(email@one.com, email@two.com));
    

    【讨论】:

    • 因此使用 addBcc($recipients) 就相当于使用调用 send() 的 foreach!
    【解决方案2】:

    您必须使用数组和foreach 循环来发送。

    这样,邮件将分别发送给所有用户。

    $users = array("email1","email2","email3"); 
    foreach ($users as $email) { 
       $mail->send() //part where you have send method 
    }
    

    【讨论】:

      猜你喜欢
      • 2011-11-21
      • 2013-11-17
      • 2018-05-30
      • 2017-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      相关资源
      最近更新 更多