php – 使用sendgrid和codeigniter将邮件发送给多个收件人

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 使用sendgrid和codeigniter将邮件发送给多个收件人脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近注册了SendGrid并看了他们与CodeignITer的集成.

他们建议您执行以下操作以发送邮件

$this->email->initialize(array(
      'PRotocol' => 'smtp','smtp_host' => 'smtp.sendgrid.net','smtp_user' => 'sendgridusername','smtp_pass' => 'sendgridpassword','smtp_port' => 587,'crlf' => "\r\n",'newline' => "\r\n"
    ));

    $this->email->From('your@example.COM','Your Name');
    $this->email->to('someone@example.com');
    $this->email->cc('another@another-example.com');
    $this->email->bcc('them@their-example.com');
    $this->email->subject('Email test');
    $this->email->;message('Testing the email class.');
    $this->email->send();

    echo $this->email->print_debugger();

这似乎是向单个人发送邮件一个很好的解决方案,但如果我有一封电子邮件我想发送给一大群人怎么办?是否可以将“to”或“bcc”作为数组发送?

对于将SendGrid与CI一起使用,是否存在不同的集成方法

谢谢!

您可以以正常方式使用它.您可以传递一组电子邮件地址或逗号分隔的电子邮件地址字符串.

喜欢

$list = array('one@example.com','two@example.com','three@example.com');
// or
//$list = 'one@example.com,two@example.com,three@example.com';

$this->email->to($list);
// or
//$this->email->cc($list);
// or
//$this->email->bcc($list);

脚本宝典总结

以上是脚本宝典为你收集整理的php – 使用sendgrid和codeigniter将邮件发送给多个收件人全部内容,希望文章能够帮你解决php – 使用sendgrid和codeigniter将邮件发送给多个收件人所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。