Mik*_*ike 7 php bcc sendgrid carbon-copy
我正在使用带有php的sendgrid,我已经使用了客户端库和curl选项这两个选项.到目前为止,我已经能够直接使用addTo选项发送电子邮件,没有任何问题.但是当我尝试添加Cc或Bcc选项时,电子邮件仍然会被发送,但副本永远不会被发送.php版本有任何已知问题吗?在其他项目中,java库工作得很好.
这是一段简单的代码,我试图让它工作
<?php
require ('sendgrid/sendgrid-php.php');
$sendgrid = new SendGrid('user', 'pwd');
$mail = new SendGrid\Email();
$mail ->addTo("mymail@gmail.com");
$mail ->addCc("other@otherserver.com");
$mail ->setFrom("sender@server.com");
$mail ->setSubject("TEST");
$mail->setHtml("<h1>Example</h1>");
$sendgrid->send($mail);
?>
Run Code Online (Sandbox Code Playgroud)
小智 10
该文档似乎没有addCc方法.你可以尝试这些替代品.
$mail = new SendGrid\Email();
$mail->addTo('foo@bar.com')->
addTo('someotheraddress@bar.com')->
addTo('another@another.com');
Run Code Online (Sandbox Code Playgroud)
要么
$mail = new SendGrid\Email();
$mail->addBcc('foo@bar.com');
$sendgrid->send($mail);
Run Code Online (Sandbox Code Playgroud)
https://github.com/sendgrid/sendgrid-php#bcc
| 归档时间: |
|
| 查看次数: |
8508 次 |
| 最近记录: |