5 steps for no-SPAM e-mails in Magento

Table of Content

5 steps for no-SPAM emails in Magento
Posted in: Magento 2 Guides

This article is based on a speech Amasty Chief Technology Officer Andrei Vachkevich gave on Meet Magento Poland 2014.

Good day to Amasty blog readers! I’ve been working with Magento for more than 5 years, and finally it's time to share some of our recent experience regarding sending e-mails in Magento.

We’ll discuss Magento SMTP module (Editor’s note. By the time of this publication, we released Magento 2 SMTP extension).

Today I will speak about how to avoid your e-mails being marked as spam. Of course if your goal is not to send spam e-mails.

Many people on Magento related forums are discussing the problem of their e-mails being marked as spam, so I decided to go with this topic and put some light on correct configuration and to create some kind of checklist.

Don't want to set Google reCaptcha up manually? Try out our Magento reCaptcha solution.

The thing is that you don't want any of your e-mails drop into the spam folder. It is very important that e-mails, especially transactional ones, appear in the inbox, otherwise in may lead to customer's confusion.

How spam filters work

First, I will describe shortly how spam filters work - not only with Magento e-mails, of course, but with all e-mails. When an e-mail comes to your server, and you have spam filter enabled, it will check the incoming message for a list of parameters.

Spam score

Each parameter can affect final spam rating in a negative or positive way. The decision whether the e-mail is spammy or not is based on the final score. Average and recommended by SpamAssassin score to treat e-mail as spam is 6.6. If score is lower - email will go through. If it's higher - it will go into spam folder. In this article I will describe the most common reasons that rise the spam score and provide some tips how to lower it. Fact is: the lower your score is, the more likely your e-mail is going to be received in your subscribers’ inboxes.

The Steps to no-SPAM e-mails in Magento

  • Server and IP Configuration
  • E-mail Structure
  • E-mail Content
  • Testing E-mail Messages

To be able to greatly decrease possibility of your e-mails getting into spam folder you must ensure your server is configured correctly and your DNS has all necessary records. The e-mail message you’re sending must contain all required headers and MIME parts. I will also put some light on e-mail makeup. After your server is fine, your e-mail message is ready, the last but not least step is to test your e-mails.

Server and IP configuration for emails in Magento

SPF DNS Record

First of all, you should configure your domain SPF record correctly. SPF record is a TXT record in your DNS that lists all IPs and hostnames that are authorized to send e-mails from your domain. This is not required by all mail servers, however it's highly recommended to keep it right. How it works: when some recipient server gets an e-mail, it checks if IP address that send this message was authorized to do so.


In addition to correct SPF record good practice is to use DomainKeys Identified Mail (DKIM). Your mail server adds a signature to each outgoing e-mail message. The signature can be used to verify sender server by reading public key located in the DNS record of your domain. So you have three parts of the whole: a private key on your server not visible to anyone, that is used to generate email signature; a signature that is included into the e-mail; and a public key listed in DNS TXT record. This is used to verify that this exact e-mail was signed with a private key of a specific server. However this point does not prevent spammers from sending e-mails using, for example, Google servers. This is more likely just an additional layer of security.

Reverse DNS

When you’re sending an e-mail from a server inside your domain, make sure it has its own IP address and its hostname is resolved to that IP address.

MX Record

Another necessary DNS record for your domain is MX record. It specifies which mail server is responsible for handling all incoming e-mail for this domain name. This is required in case your e-mail was undelivered to the recipient for some reason, so the recipient server can send undelivered notification.

'White' IP address

Sometimes your IP address may become blacklisted, if you lost your reputation by sending wrong e-mails. After you got a new IP address from your provider, it’s recommended not to use this address for at least a month. The reason behind this is that your new IP address might already be used by someone else before. This 1 month delay lets the IP address get cleared and became 'white'.


A good solution is to use SMTP server to send e-mails in Magento. It can be a public one (such as Gmail, Yahoo and so on, if you trust them), or your private mail server. We at Amasty use our own mail server based on Zimbra. There are also some paid SMTP services available on the web. Also, there are possibilities to use a single server and setup it only once for several Magento projects you run. Magento does not work with SMTP out of the box, so you need an extension for that. The drawbacks are that there are only a few extensions on the market that send e-mails using their own implementation and will not work through SMTP. Also you should maintain the server to make sure it works correctly and is backed up often.

So we have completed the first step, our server is now configured as it should be and is ready to send e-mails out. Let’s proceed to step two and look at the e-mail messages structure.


Have a look at Magento SMTP Email Settings extension! It works like a charm to ensure reliable e-mail delivery.

Apart from other features, it:

  • has Plain Text MIME part added: it is automatically generated based on HTML version
  • has Quote-printable line length for e-mail messages reduced to 75 characters
  • and more features for reliable e-mail campaigns.


Plain text part

One of the problems in Magento is that it does not send the text part. It sends only the HTML part of the message, making some spam filters give such messages a higher spam score. The text part can be entered either manually for each e-mail template, or created automatically based on HTML version. In the end of my article I will give some more details on this point. Now let’s move to the next point.

Quote-Printable line length

Recommended email structure

Quote-Printable is an encoding used in e-mail messages. Based on RFC 2822 specification, each line MUST be no more than 998 characters, and SHOULD be no more than 78 characters in length. While this seems to be a recommendation, it is used to evaluate e-mail message for spam. 76 characters length is, however, recommended. Magento by default uses 200 for quote-printable line length. This can be changed by overriding Zend_Mime class.

Embedded images

Nowadays you cannot imagine an e-mail without images at all. It is good to embed images directly into your e-mail message, but not to link them from remote sources.

Valid 'e-mail HTML'

And now a few words regarding e-mail message body structure. There is one simple rule: 'Back to 90's'.

The rule says: 'Find some old-school HTML developer, ask him to create a historical HTML piece and it will work fine for your e-mail'! It's a joke only partially, this is what you need when it comes to e-mail messages HTML coding. While some web clients and even some desktop clients can display extended HTML like DIV with paddings, most of them will just mess your e-mails up. Use tables, simple HTML with no CSS3. This is what you need for e-mail messages.

These were the major points regarding e-mail structure. Let’s move forward to the next step - e-mail content.

E-mail content recommendations for Magento

Valuable text

It's one of the most important part of the whole article! Bring value. Write text that is important and useful for your readers. Avoid pure marketing strategies aimed at profit only. Always remember that your e-mails are read by humans. I could have written a lengthy blog post on that, but, I believe, it was done by lots of people before.

No single image emails - do HTML coding

Never send e-mails consisting of a single image. I understand it’s sometimes hard to code e-mail markup, however, please do it. Single-image e-mails are mostly treated as customers spam messages.

No to link shorteners

Link shorteners can help you build nice URLs, however, they are considered as untrusted when it comes to e-mails. There is a chance an e-mail will get up to 2 whole points for spam if a shortened link is found inside the content.

We’ve completed all the steps to make our e-mail message almost perfect. Now we need to check if it really is so.

Testing e-mail messages in Magento

3rd party service

So we come to testing e-mail messages. After everything is setup and your message is ready to go, test it first. Check if it looks fine in all common e-mail clients, and also have a look at the spam score.

Okay, now you ask how you can check your e-mail in all apps, because that's not possible to do it manually. Luckily, you can use 3rd party services like Litmus. It will generate previews of your message on different platforms and in different web and desktop e-mail clients. It can also give some suggestions on HTML coding of your e-mails. Very useful tool!

Automated testing of emails

Why you need to test your e-mails at all? Once we sent an e-mail a part of which should have looked like this.

Magento email testing

And it looked like this for us. However one of our customers sent us a screenshot showing how he got our message.


Since that time we have been testing e-mail messages. In all major e-mail clients. Always. All of them!

And with PutsMail you can test your e-mail HTML code. It a simple tool that allows you to send the HTML code to your account for design testing and debugging.

Use your team

After you finished with automatic testing, I would recommend sending a few copies to your colleagues or friends. This is a kind of real life experience, and some feedback from live people may be really useful.

Test mobile view

Do not forget to test the mobile view for your Magento e-mails. Mobile market is constantly growing, so your e-mails must look perfect on mobile devices as well.

I do hope this information was helpful for you. Do you have any questions on the topic? I'll be happy to answer.

May 5, 2016
July 9, 2016
May 2, 2016
November 12, 2016
Thanks so much, Andrei, for sharing this article. I’ll try to follow your tips!
Alexandra Zhos
November 29, 2016
Thank you for your comment, we are glad to share our experience and be helpful.
December 19, 2016
What a valuable post about e-mail marketing that Andrei shared! I learned a lot here indeed. That is a great point that you are talking about using SMTP server to send e-mails in Magento. This is something that I am yet to implement. Thank you!
Alexandra Zhos
January 3, 2017
Happy to hear that! You are always welcome.
George Matsuka
February 9, 2017
Thank you for the article, you’ve just touched my sore spot. I think, another great tip is to survey your list occasionally and see who answer what and then categorize them for the segments. Taking time to pay attention to the people in your email list and taking time to deliver exactly what they want is the smart way to go right! :D
Ksenia Dobreva
February 10, 2017
Thanks for reading and commenting, George!
April 26, 2017
I must say, offering the spamcheck email tool is incredibly useful! Thank you for offering such a tool for free.
Rafael Corrêa Gomes
May 29, 2017
Thanks for sharing!
December 7, 2017
Hola, I used the [email protected] adress but i don't see a report. Please help.
Alina Bragina
January 22, 2018
Hi Jan, thanks for reading! Pity you've run into the issue. As you've already read it we don't store incoming emails but we'll try to help you with it. First, check the email address spelling. Then review your spam folder and see if there is a correct ‘reply-to/from’ headers in the outgoing emails. Good luck with that!
Nick Leduc
June 9, 2019
I'm not sure if the e-mail account is still active today, but when I tried using it to do the test I received an "Undelivered Mail Returned to Sender" response with this message: : host ASPMX.L.GOOGLE.com[] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 https://support.google.com/mail/?p=NoSuchUser w8si4678687pgr.258 - gsmtp (in reply to RCPT TO command)
Alina Bragina
June 18, 2019
Hi Nick, we'll check this out and inform you about the status as soon as possible. Thanks for reading us!
Mathew Rogger
September 9, 2018
I have read the post and it is very much helpful because I have got to know about many things which have helped me to get to know about the spam emails in Magento which came to be of great help. Contact Router Supports for more help.
Nick Leduc
June 9, 2019
Thanks, I found these tips to be very helpful. Keeping a healthy score for e-mail delivery can be such a pain sometimes.
Alina Bragina
June 18, 2019
Hi Nick, thanks for your feedback it's a real inspiration for our team!
January 16, 2020
I’m not sure if the e-mail account is still active today, but when I tried using it to do the test I received an “Undelivered Mail Returned to Sender” response with this message: : host ASPMX.L.GOOGLE.com[] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 https://support.google.com/mail/?p=NoSuchUser gz9si14527924ejb.210 - gsmtp (in reply to RCPT TO command)
Polina Litreyeva
January 20, 2020
Hi, Ivan! Thanks for your feedback. You see, this post was written in 2016, and now this e-mail is out of date. If you need any help, feel free to <a href="https://amasty.com/contacts/">contact us</a>.
January 26, 2020
Hi, Is it bad or is it OK if in the Order Email, the ordered product list contain also link to product page? Thanks!
Polina Litreyeva
January 27, 2020
Hello, Catalin. It's ok to have links in an email. However, it also has to contain text with additional information.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro