VPS mail setup

Started by CrazyNorth, Aug 14, 2022, 02:01 AM

Previous topic - Next topic

CrazyNorthTopic starter

I understand that the section was not chosen according to the rules, but I can't think of a better place on the forum. I have already asked on several communities, but have not yet received an answer, maybe the specialists will go into the thread here.

The essence of the problem. When hosting websites on some popular CMS (like Joomla, SMF or WordPress) on good hosting server, all email notifications are sent to users without any complaints with the default settings. On a VPS, I have never managed to start mail so that it does not fly into spam and stably reaches the addressees. And now it's just "locked in", and for two websites at once.

VPS with Debian 8, VestaCP is installed, pulling exim4 along with it (I didn't touch any settings). The mydomain.com domain uses DNS servers from pdd.yandex.com. There, in particular, the following entries are configured:
mail A
@ A
@ TXT v=spf1 ip4: ~all
@ MX mydomain.com. ten


This is where I got stuck. All the manuals that I found describe (and rather indistinctly) the process of setting up mail for a single domain on a VPS. But after all hosting providers keep a bunch of client sites, and messages are normally sent from each. I want the same.

Maybe there are some understandable setup guides? Or at least tell me what to google.


The fact that mail goes to spam from the VPS may be a precaution of the mail services, especially if spam was sent from the IP of this VPS earlier.
You can set up sending mail through SMTP mail services, and not through exim4 on your VPS.

But first, it's worth trying to configure various SFPs, DKIMs in the domain (on DNS), they should clearly reflect that the mail comes from such and such an IP.

If you send via SMTP to a VPS, then that can also be better than the usual mail () via PHP, although of course setting this up for each website is a hassle.

And in the end, the IP of your VPS can be trite in the database of some "spamhouse", that's why everything goes to spam, depending on where you got the VPS...

Write rDNS (PTR) for IP VDS (for instance, mail.mydomain.com).
There must be a direct A-record for mail.mydomain.com with this IP.
Configure SMTP-MTA to issue the correct prompt with the correct hostname that matches the rDNS (mail.mydomain.com)
Write SPF for host mail.mydomain.com
Some mailers check for an open TCP:25 port on IP.


For the mail to work correctly, several steps are required:

Write an MX record for the domain pointing to your webserver. For instance, for the example.com domain pointing to your server, it would be quite correct to register the example.com domain itself as an MX record. You need to do this in the registrar's control panel if it provides a DNS server, or in your server's control panel if you use your own DNS server.
Add a mail domain in the control panel.
Create mailboxes in the control panel.
It is worth paying attention to the fact that as a pop3 and smtp server, you must also register the somesite.com domain or the ip-address of the server.

Both receiving and sending mail require authorization, in which the login will be the full address of the mailbox in the form login@domain.com with the password specified when the mailbox was created.