2

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?

  • 1
    Look at the error log. That will show you why you are getting the 500 error. A 500 error is just a generic "something went wrong" error that doesn't tell you what went wrong. PHP will still write to the error log what the error was. – Jonathan Kuhn Jan 06 '16 at 20:01
  • You may need to enable the mail extension,i guess.. –  Jan 06 '16 at 20:14
  • 1
    PHP Warning: mail() expects parameter 3 to be string, array given in /home/user/index.php on line 6 –  Jan 06 '16 at 20:29
  • You should edit your original question and include the error there, not in a comment. –  Jan 06 '16 at 21:10
  • Problem solved, with this: https://github.com/Ziggeo/php-sendgrid-parse and disable Paste RAW data from settings on Sendgrid –  Jan 07 '16 at 13:18

1 Answers1

1

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

and disable Paste RAW data from settings on Sendgrid

  • This did not work for me in 2020. The example in the official document worked for me. https://sendgrid.com/docs/for-developers/tracking-events/php-code-example/ – Krish Oct 20 '20 at 05:22