微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

sendgrid收到错误:发件人地址与验证的发件人身份不匹配

如何解决sendgrid收到错误:发件人地址与验证的发件人身份不匹配

当我尝试使用From Name : xxx@gmail.com发送电子邮件不起作用时,出现此错误The from address does not match a verified Sender Identity,有人可以帮助我如何验证gmail域吗?这样我也可以从gmail发送电子邮件,这是我的代码

$email = new \SendGrid\Mail\Mail();
$email->setFrom("xxxx@gmail.com","test");
$email->setSubject("Sending with Twilio SendGrid is Fun");
$email->addTo("xxxx@gmail.com","Example User");
$email->addContent("text/plain","and easy to do anywhere,even with PHP");
$email->addContent(
    "text/html","<strong>and easy to do anywhere,even with PHP</strong>"
);

$apiKey = 'xxxxxxx';

$sendgrid = new \SendGrid($apiKey);
try {
    $response = $sendgrid->send($email);

    echo '<pre>'; 
    print_r($response); 
    exit;
    
} catch (Exception $e) {
    echo 'Caught exception: '. $e->getMessage() ."\n";
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。