在PHP中使用SendGrid发送电子邮件

在PHP中使用SendGrid发送电子邮件,php,email,smtp,sendgrid,Php,Email,Smtp,Sendgrid,如果我有一个herokuapp,比如test.herokuapp.com,我想从中发送电子邮件,我该怎么办?这就是我目前所拥有的 $sendgrid = new SendGrid(username,password); $mail = new SendGrid\Mail(); $mail->addTo('myActualEmail@mail.com')->setFrom('contactus@test.herokuapp.com')->setFromName('Jake fro

如果我有一个herokuapp,比如test.herokuapp.com,我想从中发送电子邮件,我该怎么办?这就是我目前所拥有的

$sendgrid = new SendGrid(username,password);
$mail = new SendGrid\Mail();
$mail->addTo('myActualEmail@mail.com')->setFrom('contactus@test.herokuapp.com')->setFromName('Jake from Statefarm')->setSubject($email_subject)->setText($email_body);
$sendgrid->smtp->send($email);
那好吗?由于某些原因,它没有发送可能的副本