2016-03-08 53 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