Sending mail through a Gmail address via a PHPmailer SMTP script gets flagged as spam

Posted June 6, 2015 10k views

Hi y'all,

I have a Web form I’m building for some staff members of my online community to use to notify members that their account has been suspended and for how long. No big deal, using html to POST to a PHPmailer script with all of Google’s SMTP settings (TLS mode) and the server Gmail account information filled in. It sends fine, but any account other than the backup account for the address (my personal email) receives it in the spam folder.

Now, I can understand if it was getting flagged as spam coming directly from my server, but it’s getting flagged after my server is authenticated through Google and sends it through the Gmail address.

Any idea why this is happening and what I can do to fix it? Is it because my IP (or the DO IP range) was flagged for spam from some other user?? Let me know if you need to see any of the scripts or my hosts file or anything, but everything is pretty much default.


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.

Submit an Answer
4 answers

When you’re sending things, could you state the content in the email. Some words trigger gmail spam filter.

  • This is the content (straight from $body in my file):

    “Attention account holder,<br \>This is a notice informing you that your ******** account has been suspended. Please review the following information.<br \><br \>Account Name: $email<br \>Character Name: $charname<br \>Server: $servername<br \>Ban Reason: $banreason<br \>Ban Type: $bantype<br \>Ban End Date: $date $time Server Time<br \>Banning staff member: $gmname<br \><br \>If you would like to appeal your ban because you feel that you were incorrectly punished, please follow the instructions in the following thread: (link here, removed)<br \><br \>DO NOT REPLY TO THIS EMAIL.”;

    I had a link that I removed and it appears to be working on gmail accounts now, but my friend who has outlook/hotmail/etc is still getting it sent to spam.

Look if reverse DNS work, if not rename your Droplet to e.g.
To do this go to Droplet,Settings,Rename

Every mail without reverse DNS is SPAM for Google

  • It says:
    (unable to resolve 45.55.************)

    I have multiple domains on this server, does it matter which one I rename it to?

@parrella20 it doesn’t matter. But I would prefer to use your main domain.