Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Response while sending mail through sendgrid using PHP

I am sending mail through sendgrid. I am using sendgrid-php library. After sending the mail, i am receiving the mail.

$sendgrid = new SendGrid($username, $password,array("turn_off_ssl_verification" =>   true));
$email = new SendGrid\Email();
 $emailaddress=array('[email protected]','[email protected]','[email protected]');
  $email->setTos($emailaddress)->
   setFrom('[email protected]')->
   setSubject('Test Mail')->
   setText('Hi i have sent you a mail!')->
   setHtml('<strong>Hello World!</strong>');
 $response=$sendgrid->send($email);
 print_r($response);

After printing the response, i am getting this output

stdClass Object ( [message] => success ) 

even if the mail address is not proper.I am getting the same output.

like image 669
Matchendran Avatar asked May 13 '26 23:05

Matchendran


1 Answers

The success means that SendGrid successfully received the message from you, and has begun processing it. To learn the final state of the message, you need to implement the Event Webhook, which requires a Bronze or higher package.

like image 175
jacobmovingfwd Avatar answered May 16 '26 14:05

jacobmovingfwd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!