Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SendGrid Cc和Bcc在PHP上不工作_Php_Sendgrid_Bcc_Carbon Copy - Fatal编程技术网

SendGrid Cc和Bcc在PHP上不工作

SendGrid Cc和Bcc在PHP上不工作,php,sendgrid,bcc,carbon-copy,Php,Sendgrid,Bcc,Carbon Copy,我在php中使用sendgrid,我使用了两个选项—客户端库和curl选项。到目前为止,我已经能够用addTo选项直接发送电子邮件,没有问题。但当我尝试添加抄送或密件抄送选项时,电子邮件仍然会被发送,但副本永远不会被发送。php版本是否存在任何已知问题?在另一个项目中,java库工作得很好 下面是一段简单的代码,我正试图让它工作 <?php require ('sendgrid/sendgrid-php.php'); $sendgrid = new SendGrid('user', 'p

我在php中使用sendgrid,我使用了两个选项—客户端库和curl选项。到目前为止,我已经能够用addTo选项直接发送电子邮件,没有问题。但当我尝试添加抄送或密件抄送选项时,电子邮件仍然会被发送,但副本永远不会被发送。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);

?>

该文档似乎没有addCc方法。 你可以试试这些选择

$mail = new SendGrid\Email();
$mail->addTo('foo@bar.com')->
       addTo('someotheraddress@bar.com')->
       addTo('another@another.com');


var_dump($mail)和post outputMultiple addTo模仿密件抄送,但我需要将电子邮件与其各自的抄送和密件抄送一起发送。方法addCc没有出现在文档中,但它出现在库中。他们已从文档中删除了addCc。您也可以在此处查看此问题。很高兴知道这一点。谢谢,我想我会采用phpMailer方法来解决这个问题
$mail   = new SendGrid\Email();
$mail->addBcc('foo@bar.com');
$sendgrid->send($mail);