User Tools

Site Tools


hints:mail_forwarding

This is an old revision of the document!


Mail forwarding

[ Classic Linux and DirectAdmin. ]

Incoming mail can be automatically forwarded in several different ways. Before enabling mail forwarding, please be sure to read the Mail forwarding problems and Mail forwarding solution sections later in this document.

Catch-all not supported. Catch-all mail forwarding means all mail arriving for every address in a given domain is delivered or forwarded. Unfortunately this leads to dictionary attacks, where a spammer sends to random addresses in a domain, hoping that some will reach a real address. For this reason catch-all mail forwarding is not supported. However, you can use plus addressing to create arbitrary addresses at any time.

Always test

Whichever mail forwarding method you use from below, always test. Send yourself mail from some outside service and check to make sure it got forwarded as expected. This will help prevent silent loss of mail, where mail gets accidentally forwarded into oblivion, or even to the wrong person.

Backscatter caused by forwarded spam

When you forward mail, unless you use procmail, spam will be forwarded. The receiving site may reject the spam, causing the forwarded mail to bounce back to the original sender. If the sender address was forged, this will cause the bounce to go to some innocent party. This type of bounce is called backscatter. Excessive backscatter from our servers may cause us to be added to block lists, causing all mail originating from the server fail.

For this reason, if you receive any noticeable amount of spam to an email addresses, you should forward mail arriving for that email address only by using procmail, and using our example .procmailrc file for mail forwarding to block most spam from being forwarded.

In the Classic Linux environment, if you use the mailq command and find any significant amount of queued mail that seems to be to you or from you, quite likely this is backscatter being generated by mail forwarding that you are doing.

Mail forwarding with a .forward file

Forwarding mail with a .forward file will forward spam.

You can create a .forward file in your home directory. Incoming mail for your primary Linux login (USER@rahul.net in Classic Linux, or USER@jade-new.rahul.net in DirectAdmin) will be automatically forwarded to any address(es) found in the .forward file. These addresses can be on a single line in the .forward file, separated by commas, or one per line without commas. These are examples of syntactically valid .forward files:

xxx@example.com
xxx@example.com,yyy@example.com
xxx@example.com
yyy@example.com

Mail forwarding with a .forward file and keeping a copy

Forwarding mail with a .forward file will forward spam.

To forward but also deliver into your normal mailbox, include your Linux login name as a forwarding recipient, but prepend a backslash to it. Examples are below. USER stands for your own Linux login name.

\USER,xxx@example.com
\USER,xxx@example.com,yyy@example.com
\USER
xxx@example.com
yyy@example.com

Mail forwarding with Procmail

You can put rules into a .procmailrc file that resides in your home directory. These rules can forward selected mail or all mail that arrives for your for your primary Linux login. You can avoid forwarding spam. Please see our Procmail help pages:

Mail forwarding from within your control panel

Forwarding mail from within your control panel will forward spam.

You can set up mail forwarding from within your Virtualmin or DirectAdmin control panel.

Mail forwarding problems

Mail forwarding problems are common. They are almost always caused by anti-spam techniques. DNS records called SPF, DKIM, and DMARC are used by sites to specify how mail originating from their domains should be handled. These DNS records let mail receiving sites identify forged sender addresses.

When you set up mail forwarding, mail will be received by our servers and then re-transmitted to the destination of the mail forwarding entry. So mail that originated elsewhere will appear to be coming from our server.

Depending on the handling specified by SPF, DKIM, and DMARC records for the domain that appears in the sender address in forwarded mail, a receiving site might refile forwarded mail as spam, reject it temporarily thus slowing its delivery, or reject it so it bounces back. If the sender was human, they will see the bounce and know that mail did not get delivered. A properly run mailing list will keep track of bounces and let you find out how much mail to you has bounced in the past.

But if the sender is a poorly administered site, such as a typical bank, stock fund, or online retailer, they will discard the bounce and make no effort to notify you. You will never know that the mail never reached you.

We highly recommend exercising caution when forwarding mail, and not forwarding important mail at all.

But there is another solution. See below.

Mail forwarding solution

Many email sites give you an alternate mechanism. They will fetch your mail from our servers via POP or IMAP, if you give them your login information. Only if you trust such a site with your login name and password, then this mechanism is preferable to normal mail forwarding. It does not suffer from the spam problem. Your mail will be safely fetched regardless of a sending domain's spam policies.

hints/mail_forwarding.1612767195.txt.gz · Last modified: 2021/02/07 22:53 by admin