我最近注册了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();
Run Code Online (Sandbox Code Playgroud)
这对于向单个人发送电子邮件似乎是一个很好的解决方案,但如果我有一封电子邮件要发送给一大群人呢?是否可以将"to"或"bcc"作为数组发送?
对于将SendGrid与CI一起使用,是否存在不同的集成方法?
谢谢!
嗨朋友,我在codeigniter创建新闻通讯.有没有办法用CI电子邮件库发送多个电子邮件或我应该使用第三方?