如何解决为什么我的SendGrid帐户不希望通过Php发送消息?
即使我从SendGrid网站键入了正确的代码,我仍然无法通过PHP连接SendGrid,但是它不希望发送消息,并且我的请求也没有出现在SendGrid帐户的“请求”列表中! API密钥正确
require('sendgrid-PHP/sendgrid-PHP.PHP');
$api_key = "###########";
$email = new \SendGrid\Mail\Mail();
$email->setFrom("support@codux.me","Codux Inc.");
$email->setSubject($subject_contacter);
$email->addTo($email_contacter,$name_contacter);
$email->addContent("text/plain",$message_contacter);
$sendgrid = new \SendGrid(getenv($api_key));
if($sendgrid->send($email)){
echo '<div class="alert alert-success">success send</div>';
} else {
echo "<div class='alert alert-danger' role='alert'>We apologize! We are unable to receive your request</div>";
}```
解决方法
我已解决问题,请检查新代码:
Service
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。