Forwarding Email from Hosts with no DNS Entries

Last Updated on 12/25/2012 by dboth

It may sometimes be necessary to send email from hosts that do not have DNS entries on the Internet DNS servers. In my case it is because I need to be able to receive emails from single end user computers that are connected directly to the Internet, as in the case of residential or small business users that have neither DNS entries nor their own mail server.

The email I need to receive helps me monitor my customers’ systems and consists of daily cron job output, logwatch email and more. This can alert me to problems before my customers become aware of them and allows me to resolve them before they become noticeable, which is always a good thing.

The reason this email does not normally pass through the email system to you is that it is sent with invalid domain information in the envelope. It therefore gets rejected by the receiving MTA. To resolve this we need to set up the stand-alone local host as a mail server and configure it to send email with a valid domain name.

This document assumes that you are using Fedora but should work with any Linux distribution and sendmail.


First you must install sendmail and sendmail-cf if they are not already. In general, Fedora installation CDs or DVDs install sendmail by default so you should not have to install sendmail itself. You will probably need to install sendmail-cf which allows you to use the make command to compile revised sendmail databases and configuration files.

yum -y install sendmail-cf


Now there are a few things to configure before we are able to receive email from a stand-alone host.

Setting the hostname

Set hostname of the computer to something with a valid domain name. I typically use the following command.


Then set the HOSTNAME= line in /etc/sysconfig/network to the same thing.

Configure sendmail

Fedora distributes sendmail pre-configured well enough to work with only a few minor modifications. In this case we only need to make a single modification.

Find the following line in /etc/mail/


Remove the “dnl” from the beginning of the line. The “dnl” tells the sendmail compiler, m4, that the line is a comment and should be ignored. Change that line to add your own domain:


This tells sendmail to set the From: address of the email envelope to “” which is a valid domain.

Make /etc/mail the working directory (pwd) and run the command:


Restart sendmail.

service sendmail restart

Now find the line in /etc/aliases that looks like this:

# Person who should get root’s mail

And change it to:

# Person who should get root’s mail

Then run the command:


This sets up sendmail to send all email that is addresses to root on the local host to be sent to you at your desired email address.


We are now ready to test the new configuration. I use the following command line to send an email from the remote host after logging in using SSH.

echo “This is a test” | mail -s “Test 1”

If this email gets through to you, everything is working.

Firewall Issues

Ensure that your firewall is configured to pass email from the external host. You may have to add a line to allow the specific IP address of the host to send email to your network.

Leave a Reply