0

in php.ini, I set : sendmail_path = "/usr/local/bin/msmtp -f info@abisy.de -C /var/www/vhosts/abisy.de/.msmtprc -t"

but the EMails sent with php mail() are landing in the spam dir of my mail account. These mails do not contain a sender address

I use the -f option, and additionally I set the From: header in php

1 Answers1

0

The -f option sets the SMTP envelope sender. In order to appease your spam filter, you'll need to set a From: header. These usually contain the same value. You can set the From: header by passing the $additional_headers parameter to the mail() function. Note, doing this won't guarantee that your emails will stay out of the spam folder. You may have to take additional measures like implementing SPF and/or DKIM. Overall, dealing with emails is usually much easier if you just use an API service like Mailgun.

Alex Howansky
  • 50,515
  • 8
  • 78
  • 98