2016-03-08 28 views
3

我正在使用sendgrid API向多个收件人发送电子邮件!现在保留sendgrid API中的收件人

<?php 


$email = new SendGrid\Email(); 
$sendgrid = new SendGrid('API_KEY'); 

$email 
    ->addTo(array('[email protected]','[email protected]'..)) 
    ->setFrom('[email protected]') 
    ->setSubject('Subject goes here') 
    ->setText('Hello World!') 
    ->setHtml('<strong>Hello World!</strong>') 
; 

$sendgrid->send($email); 

,我想知道是否有任何方式隐藏在“To”报头的第一个电子邮件的第二电子邮件?

+0

设置第二个电子邮件BCC场? – Zuzlx

+0

@Zuzlx我不想使用bcc提交,有没有其他方式? – Masseleria

回答

3

使用SMTP API进行邮件合并类型功能。

使用sendgrid-php,看起来像:

$email = new SendGrid\Email(); 
$email 
    ->addSmtpapiTo('[email protected]') 
    ->addSmtpapiTo('[email protected]', 'Mike Bar') 
; 
$sendgrid->send($email); 

或为数组:

$email = new SendGrid\Email(); 
$emails = array("[email protected]", "Brian Bar <[email protected]>", "[email protected]"); 
$email->setSmtpapiTos($emails); 
$sendgrid->send($email); 
+0

谢谢你,因为你的回答,这已经解决了:) – Masseleria