I am not able to send mails using php mail() function to gmail accounts.

While sending mails using php mail function mails are not delivering to gmail accounts while it is working for other accounts. Can you help me out to solve this issue?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @diveshjain25,

Are you using SMTP authentication with the mail function?

Additionally, I’ll recommend using an e-mail checker to see what e-mail score you’ll get. The link is here - The way it works is you send a message to the given e-mail account and check the score of your message. It will provide you with a scale from 1 to 10 and notify you about any issues you might need to fix.

Try it out and see if after making a 10/10 score on the tester the messages will still be marked as spam.

One other thing, you know content does matter and it’s possibly Gmail are marking your messages based on it as well.

Regards, KFSys

Hello @diveshjain25

I have seen adding SPF and DKIM records solves such a problem. Also, make sure that you have added <> around From and Reply to addresses so that Gmail server considers it has genuine email (not spam).

If it doesn’t work then you might have to reach out to support with email bounce back (if any) or with any information to trace the issue.