There is an application that sends a password recovery form via the mailgun service. The body of the letter contains information and a link to the website. Mail services gmail, mail.ru put the sent letters in the spam list. Is there a way to avoid this?
2 answers
When sending emails from cloud mail services, there are a few items that need to be followed:
Add the domain from which mail is sent to Mailgun
Mailgun provides a temporary domain / address of the type sandbox275a1376f9c547b4a5d2a3b511234567.mailgun.org
for sending emails. But if you send letters from your personal domain, you need to register it with Mailgun.
For example, if letters leave with no-reply@foobar.com
, it means that you need to add the domain foobar.com
that you own to foobar.com
. You can do this in your Mailgun account, following the instructions .
Add DKIM and SPF records
When a mail service receives a letter from somewhere, it will know which server it came from and which domain it came from. For example, our letter sent via Mailgun will arrive at the mail service from Mailgun servers (related to mailgun.org) and from no-reply@foobar.com
.
The postal service finds out two things:
- Did the email really come from the domain owner
foobar.com
? After all, anyone could send him from such an address .. - The letter came from third-party Mailgun servers that are not directly associated with the domain. Does the owner of the
foobar.com
domainfoobar.com
send mail through the Mailgun server?
To do this, the postal service addresses the domain's DNS-records, and by their presence understands that the letter was indeed sent by the owner of the domain and from servers approved by him. Otherwise, the postal service will consider such a letter fraudulent and send it to spam.
Mailgun also has instructions for adding DKIM and SPF records. You need to add them in the DNS settings of your domain. Either where you bought it, or on third-party NS-servers, for example on pdd.yandex.ru .
After adding the server to Mailgun - in your account, go to the page of this domain (this link: https://mailgun.com/app/domains/foobar.com ), and follow the instructions of Mailgun.
And the other server did not try? Or send from your site? There are a number of ways that help increase the credibility of your letter (that is, reduce the likelihood of considering them as spam). A very good collection of recommendations is in google - https://support.google.com/mail/answer/81126?hl=en
Here are some points from it:
- For bulk emails, use a fixed IP address.
- For the IP addresses from which messages are sent, there must be valid DNS reverse records pointing to your domain.
- Use the same address in the "From:" field in all mass mailings.
- Sign messages with DKIM key. Gmail accepts keys that are at least 1024 bits long.
- Post your SPF records.
- Post a DMARC policy.
Using your own server, it will be more convenient for you to control the fulfillment of these requirements.