You see an automatic translation. Please switch to our English original page in case of comprehension problems.

How do I set up cPanel/WHM to accept incoming messages only from the EuropeanMX servers?


To restrict the delivery of incoming messages in cPanel/WHM to the servers of EuropeanMX, please follow the steps below. 

If the MX records (mx1.europeanmx.eu, mx2.europeanmx.eu, mx3.europeanmx.eu, mx4.europeanmx.eu) for the domain are correctly specified in the DNS system, the following settings will result in

  • all messages submitted via a connection from *.antispamcloud.com will be accepted
  • all messages not originating from this hostname are rejected

If the receiving domain does not use our MX records, then it is assumed that the domain does not use the filter and messages delivered directly to your mail server for that domain will be accepted.

1

Connect to the WHM server via SSH.

2

Create a new file /opt/setest with the following content:

#!/bin/bash
host -t MX $1 | sort -n -k1 | cut -d ' ' -f 7 | sed -e 's/\.$//' | xargs | sed -e 's/ /:/g' | tr -d '\n'
3

Save this file.

4

Create a new file /opt/setestptr with the following content:

#!/bin/bash
host -t PTR $1 | cut -d ' ' -f5 | sed 's/\.$//g' | tr -d '\n'
5

Save this file.

6

Open the Exim Configuration Editor and activate the advanced mode. Now search for custom_begin_recp_verify.

7

Now add the following content:

######################################################################################
## Start EuropeanMX verification
defer
!condition = ${if match_domain{${run {/opt/setestptr $sender_host_address}}}{*.antispamcloud.com}}
set acl_m_mx_records = ${run {/opt/setest $domain}}
condition = ${if eq{$acl_m_mx_records}{mx1.europeanmx.eu:mx2.europeanmx.eu:mx3.europeanmx.eu:mx4.europeanmx.eu}}
message = Please deliver mail to the address specified in the MX records for this domain.
## End EuropeanMX verification
#####################################################################
9

Save the settings.


Was this article helpful?
No Yes
We use cookies for the technical functionality of this website. With your consent, we also collect page views and other statistical data in anonymized form.

Select individually
Cookie Settings
Read Privacy Statement