Best Mail Setup to Just Forward Email?
However, I will be munging various subject lines.
I'm doing this so I can have email aliases setup like
Some email addresses will just forward as-is.
So…what is the best way to do this? procmail for the munging but what should I setup as far as the mail program itself?
3 Replies
/etc/postfix/virtual
...
rtucker@example.com rtucker+example_com@gmail.com.munger
...
/etc/postfix/transport
.munger munger:
/etc/postfix/main.cf
munger_destination_recipient_limit = 1
/etc/postfix/master.cf
...
munger unix - n n - - pipe
flags=q user=nobody argv=/etc/postfix/redirector ${mailbox}@${nexthop} ${original_recipient}
...
/etc/postfix/redirector
#!/bin/bash
# Redirects mail to make SPF happy.
# Ryan Tucker <rtucker@gmail.com>, 2010 Oct 24
# Based on http://serverfault.com/q/82234/54177
HOSTNAME=`hostname -f`
DESTINATION=`echo "$1" | sed 's/.munger$//'`
/usr/sbin/sendmail -bm -f "mail@$HOSTNAME" "$DESTINATION"
logger -i -p mail.info -t redirector "Redirecting message to $DESTINATION (orig to $2)"</rtucker@gmail.com>
I thought it was pretty clever: to route mail through it, just append .munger to the recipient e-mail address. You could do something similar without having to do a lot of manual configuration, if you wanted to dedicate something.example.com to the job… en.example.com pipes through procmail to add "#${MAILBOX}" to the subject, so
Or, search for docs on setting up postfix+procmail and someone'll probably have your use case ready to roll.