Matchendran
Matchendran

Reputation: 433

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.

Upvotes: 3

Views: 2285

Answers (1)

jacobmovingfwd
jacobmovingfwd

Reputation: 2273

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.

Upvotes: 4

Related Questions