| Contributed by: | based on contribution by Martin Elhøj |
| Created/Updated: |
This Howto describes how you can setup a relay mail server in case that your ISP has blocked for the SMTP port (port 25). This howto requires that you know someone who does not have a blocked SMTP port and is willing to spool your email for you.
Configuration related to main mail server
First you need to change your DNS configuration for the main mail server. Please be aware that this is not on the SME box but on your DNS provider such as DynDNS or, GratisDNS.
Remove the entry for your mail server and add new MX record with the name of your relay mail server.
| MX (@host -> A record mailserver) | |||
| Host | Mail Exchange | Preference | TTL |
| swerts-knudsen.com | relay-mail-server.com | 10 | 43200 |
First you need to inform qmail on which new bypass SMTP port it should listen for mail. This naturally has to done by use of templates.
[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/etc/services
[root@e-smith]# cd /etc/e-smith/templates-custom/etc/services
[root@e-smith]# echo "smtp <bypass port>/tcp mail > domain_name
[root@e-smith]# /sbin/e-smith/expand-template /etc/services
Now as the last thing on you main mail server you need to restart qmail.
[root@e-smith]# /etc/rc.d/init.d/smtpfront-qmail restart
Configuration related to relay mail server
First you need to allow SMTP request from the main domain to be relayed/spooled on the relay server. This is done by adding domain entries on the rcpthosts file. You need to add the portion of the mail address with comes after the "@". In my case this is "swerts-knudsen.dk" and "swerts-knudsen.com". This naturally has to done by use of templates.
[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/var/qmail/control/rcpthosts
[root@e-smith]# cd /etc/e-smith/templates-custom/var/qmail/control/rcpthosts
[root@e-smith]# echo "domain_name" > domain_name
[root@e-smith]# /sbin/e-smith/expand-template /var/qmail/control/rcpthosts
Please
be careful with this file - it controls the relay functions. If it is
mis-configurred your SMTP server could be used for spamming.
Secondly you need to tell qmail where you send mail that it is spooling/relaying. The format of the line(s) you need to inserts is as follows:
domain_name:[IP address of main mail server]:bypass smtp port
or
domain_name:main mail server:bypass smtp port
[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/var/qmail/control/smtproutes
[root@e-smith]# cd /etc/e-smith/templates-custom/var/qmail/control/smtproutes
[root@e-smith]# echo "domain_name:[1.2.3.4:25]:bypass port" > domain_name
[root@e-smith]# /sbin/e-smith/expand-template /var/qmail/control/smtproutes
Now as the last thing you need to restart qmail.
[root@e-smith]# /etc/rc.d/init.d/smtpfront-qmail restart
Then you should be done. If you want to check whether it actually works then check the following log file for new entries:
[root@e-smith]# tail -f /var/log/qmail/current
This can be done on the relay server as well as the main mail server.