我使用sendgrid API向多个收件人发送电子邮件!
<?php
$email = new SendGrid\Email();
$sendgrid = new SendGrid('API_KEY');
$email
->addTo(array('first@mail.com','second@mail.com'..))
->setFrom('my@mail.com')
->setSubject('Subject goes here')
->setText('Hello World!')
->setHtml('<strong>Hello World!</strong>')
;
$sendgrid->send($email);
现在,我想知道是否有任何方法可以隐藏&#34; To&#34;第一封电子邮件的标题?
答案 0 :(得分:3)
使用SMTP API进行邮件合并类型功能。
使用sendgrid-php,如下所示:
$email = new SendGrid\Email();
$email
->addSmtpapiTo('foo@bar.com')
->addSmtpapiTo('another@another.com', 'Mike Bar')
;
$sendgrid->send($email);
或者对于数组:
$email = new SendGrid\Email();
$emails = array("foo@bar.com", "Brian Bar <bar@example.com>", "other@example.com");
$email->setSmtpapiTos($emails);
$sendgrid->send($email);