问题描述
当我尝试使用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 (将#修改为@)