Search code examples
phpemailsendgridinbound

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("[email protected]","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("[email protected]","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?


Solution

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

    and disable Paste RAW data from settings on Sendgrid