OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Configure Postfix for local delivery + forward to another address

From: /dev/rob0 (rob0gmx.co.uk)
Date: Thu Nov 05 2009 - 07:52:57 CST


On Wednesday 04 November 2009 05:51:37 Keith Palmer wrote:
> I'd like to configure Postfix to locally deliver the mail and also
> forward it to another address.
>
> I'm using unix account for the mailboxes. How do I have to configure
> /etc/aliases (or something else) to have it deliver the mail locally and
> also forward a copy of that message on to another e-mail address (hosted
> somewhere else)?

You don't have to configure anything, in Postfix, this is what the
user-controlled .forward feature is for. See
    http://www.postfix.org/aliases.5.html
(or your own local copy) for syntax, and local.8.html for details.

Sample: Example.com is myorigin and is in mydestination, "user" is a
system account HOME=/home/user, example.net is hosted elsewhere.
~user/.forward contains:
    /home/user/Mail/
    userexample.net
~user/Mail/ would be a maildir, and the message would be forwarded to
the example.net MX using the same envelope sender as it was received.

This is 2009, and the vast majority of all SMTP traffic is abuse, and
same-envelope forwarding which was fine in the past will often not be
accepted at sites today. The problem compounds when spam is received
and forwarded, and if content filtering is in use at the forwarding
recipient site. Your site then might get flagged as a spam source.

The safest way to do this is to pipe the mail to a simple script that
encodes (or even encrypts) the mail and forwards it using envelope
sender userexample.com to userexample.net. Encoding/encrypting is
optional, of course; you could simply invoke sendmail(1):
    |"/usr/sbin/sendmail -i userexample.net"
but as alluded above, could get you in trouble eventually.

How to encode or encrypt is beyond the scope of this list. If I was
doing it, I would probably use gpg(1) and Heirloom mailx(1) or
mutt(1) to create and manage headers and MIME.
--
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header