Nowadays, it is hard to prevent email from going to junk mail if you intend to spam. Most mail servers on the internet deploy spam detection and filtering software that use complex algorithms to detect spammers. The software can tell if you are a spammer from the content of your emails. But if you design your email sending software carefully, you can reduce the probability of your email going to junk. Here are some basic tips.
Add From:, To: Subject: Date: headers to the message. Although they are not necessary, your email is almost definitely going to spam folder without them. The Date header is often ignored but it really matters.
Don’t just create a text/html body. Otherwise, SpamAssassin will detect this as
MIME_HTML_ONLY BODY: Message only has text/html MIME parts
Even you want HTML email content, you’d better create another text/plain mime part and make the email a multi-part email. For the text/html MIME part, you should enclose the html content with <html> and </html> tags. Otherwise, you will get
HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML
All these contribute the spam score.
Add SPF/DKIM /RDNS PTR record to DNS. The importance of SPF/DKIM/Reverse DNS can be seen in the following report of some spam detection software(these are the headers added to your email message by the spam detection software).
X-Spam-Status: No, score=-0.2
X-Ham-Report: Spam detection software, running on the system "lax.hawkhost.com",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
root\@localhost for details.
Content preview: after add date header
Content analysis details: (-0.2 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was
for more information.
Here is a spam detection report from port25.com.(You can get the report by sending an email to email@example.com)
This message is an automatic response from Port25′s authentication verifier
service at verifier.port25.com. The service allows email senders to perform
a simple check of various sender authentication mechanisms. It is provided
free of charge, in the hope that it is useful to the email community. While
it is not officially supported, we welcome any feedback you may have at
Thank you for using the verifier,
The Port25 Solutions, Inc. team
Summary of Results
SPF check: pass
“iprev” check: pass
DKIM check: pass
SpamAssassin check: ham