Skip to content
Advertisement

Sendgrid inbound email with PHP

I have configured a service for inbound email with record MX on Sendgrid. When receive email the callback URL has this function:

mail("contact@example.com","New Email", "New Email from Sendgrid"); 

and it work perfect, now i need to get the information from email, i have read the documentation:

https://sendgrid.com/docs/API_Reference/Webhooks/parse.html

and it say to use POST, ok i use post for getting the value:

mail("contact@example.com","New Email", $_POST['from']); 

in this mode not work, return this error:

PHP Warning: mail() expects parameter 3 to be string, array given in    /home/user/index.php on line 6

Can someone please help me?

Advertisement

Answer

Problem solved, with this: https://github.com/Ziggeo/php-sendgrid-parse

and disable Paste RAW data from settings on Sendgrid

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement