DEV Community

Cover image for How to send emails that are not marked as SPAM?
Lyubomir Angelov
Lyubomir Angelov

Posted on • Originally published at

How to send emails that are not marked as SPAM?

Recently I helped one company to prevent common emails for registrations and etc. to be marked as SPAM automatically from users mailboxes.

When you are using third-party service like MailChimp and with your own domain to send your emails you have to do several steps to prove all mailboxes that you are you and that you are not some spammer.

To do that all services will have instructions on how to set DKIM and SPF records to your domain name that you will be using for sending the email. Usually, I create a subdomain like, then we have to add those DKIM and SPF records provided by the service.

They represent texts which tell to mailboxes that you are using different service for sending emails then your own server

MailChimp examples are:

    • DKIM:
    Create a CNAME record for with this value:

    • SPF:
    Create a TXT record for with this value: v=spf1 ?all

If you follow all the instructions of the service you will have a subdomain with DKIM and SPF records and then you should be ready to send all your newsletters and common emails with no problems.

Despite the above configurations, mailboxes like Gmail might mark your emails as SPAM. Why? Because there is one last step that you have to configure when sending emails.
Your From record have to match the sender, otherwise, it is not trusted.

Let's give an example:

    Received: by

In that example, the domain that the service is using for sending the email is different from the domain that is used in the From.

But if you change that to:

    Received: by

Emails won't be marked as spam because sender domain and email From domain are the same.
With Reply-to when the user wants to reply to our email, he will write not to but to what we defined in Reply-to.

Hope that will help someone with his emails. :)

Top comments (0)