VDS mail setup

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

Previous topic - Next topic

CrazyNorthTopic starter

Although I understand that the section I chose on the forum was not according to the rules, I cannot think of a better place for my question. In fact, I have already asked several communities, but so far, I have not received any answers. Perhaps the experts in this forum will be able to help me out.

The problem I am facing has to do with email notifications. When I host websites on some popular CMS platforms, such as Joomla, SMF, or WordPress, on a good hosting server, all email notifications are sent to users without any issues using the default settings. However, when I try on a VPS, I have never been successful in configuring mail settings so that it does not end up in spam and reliably reaches its addressees. Currently, I am stuck trying to get this to work with two websites.

My VPS is running Debian 8 with VestaCP installed, and exim4 comes along with it by default (I haven't changed any settings). My domain, mydomain.com, uses DNS servers from pdd.yandex.com. The following entries are configured there:

- mail A 1.2.3.4
- @ A 1.2.3.4
- @ TXT v=spf1 ip4:1.2.3.4 ~all
- @ MX mydomain.com. ten

Despite my research, I could not get the process of setting up mail for client sites clear. Most manuals available online only describe the process for setting up mail for a single domain on a VPS rather vaguely. Since hosting providers keep multiple client sites, the messages are usually sent from each. I would appreciate it if anyone could point me towards an understandable guide or at least give me some guidance on what search terms I should use.
  •  

Lechlak

If you are facing an issue where mail sent from a VPS ends up in spam, it might be a precaution taken by mail services, particularly if there has been spam sent from the VPS IP before. In order to resolve this issue, you could try setting up sending mail through SMTP mail services instead of exim4 on your VPS.

However, before doing that, it is advisable to configure various SFPs, DKIMs in the domain (on DNS), which should clearly reflect that the mail comes from such and such an IP.

Sending via SMTP to a VPS can be better than the usual mail () via PHP, although setting it up for each website can be quite tedious. Additionally, the IP of your VPS may have been blacklisted by some "spamhouse," resulting in your mail ending up in spam, depending on where you obtained the VPS.

To resolve this, you can write rDNS (PTR) for IP VDS (for example, mail.mydomain.com), set up 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, and set up DKIM/DMARC.
  •  

spinneren

To ensure that your mail works seamlessly, you need to undertake several steps. Firstly, you must write an MX record for the domain pointing to your webserver. For example, if you want the example.com domain to point to your server, you can register the example.com domain itself as an MX record in the registrar's control panel or on your server's control panel if you use your own DNS server.

Next, you should add a mail domain in the control panel and create mailboxes in the control panel. Additionally, it is important to note that when registering the domain or IP address of the server as the pop3 and smtp server, careful attention must be paid.

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