# Incoming email MX server

{% hint style="info" %}
Each Velocity MTA sending IP listens for incoming email replies on port 25 for authorized receiving domains
{% endhint %}

{% hint style="info" %}
**conf/receiving\_domains**\
In order to accept email for a domain as an incoming MX server, the receiving domain must be listed in velocity-install/conf/receiving\_domains, with one domain per line. Any domains not listed in this file will have their email rejected. &#x20;
{% endhint %}

{% code overflow="wrap" %}

```
mta.fivetacofeista.com
ehondasnephew.com
```

{% endcode %}

{% hint style="success" %}
Velocity MTA must be restarted for changes to take effect.
{% endhint %}

{% hint style="info" %}
**Adding MX records to your DNS**

In order for mailbox providers like Yahoo to know they can send email replies and complaint feedback loops to your Velocity MTA server, you must create an MX record pointing to your Velocity MTA IP address on your DNS hosting provider. &#x20;
{% endhint %}

{% hint style="warning" %}
**MX records are idiosyncratic**&#x20;

You must first create a DNS A record that points to your Velocity MTA IP address, then create an MX record that specifies that A record will be the MX record for your sending domain or subdomain.
{% endhint %}

Using Cloudflare as our example DNS hosting provider, our A record named "MX" will be the MX record for the sending subdomain sendmail.vitamindispatch.com.

<figure><img src="https://2024949584-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHNgw7cfnOYHQr0B6GDXr%2Fuploads%2FqdegQ0Q3sZAhs1JthRZd%2FScreenshot%202023-06-09%20at%205.01.47%20AM.png?alt=media&#x26;token=9968cb0c-88d8-4237-8ec7-ae22b8eab3c1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**MX record priority**

MX records require setting a priority, with the lowest number receiving the highest preference. Setting priority 0 will make an MX record the first to be attempted in a load balanced configuration with multiple servers handling a high volume of inbound mail.&#x20;
{% endhint %}

Using the terminal command **dig** we can verify our MX record is active and pointing to the right place.&#x20;

```
dig sendmail.vitamindispatch.com MX @1.1.1.1
```

```
;; ANSWER SECTION:
sendmail.vitamindispatch.com. 300 IN	MX	0 mx.vitamindispatch.com.

;; Query time: 85 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Fri Jun 09 04:56:16 PDT 2023
;; MSG SIZE  rcvd: 76

```

{% hint style="info" %}
Incoming messages are stored in plain text as individual files in the velocity-install/mail/new directory.&#x20;
{% endhint %}

```
ls -alctr velocity-install/mail/new
```

```
total 20
drwxr-xr-x 5 root root 4096 Apr  6 16:00 ..
-rw-r--r-- 1 root root 9231 Apr 17 06:46 c09d311382dcdb2b0784c02c225e34f0

```
