Linode Forum
https://forum.linode.com/

Best Mail Setup to Just Forward Email?
https://forum.linode.com/viewtopic.php?f=11&t=7807
Page 1 of 1

Author:  raindog308 [ Sun Sep 25, 2011 4:18 pm ]
Post subject:  Best Mail Setup to Just Forward Email?

I would like my linode to simply forward all mail sent to it.

However, I will be munging various subject lines.

I'm doing this so I can have email aliases setup like en-work@example.com, and any email sent to that would add "#work" to the subject so it'd be sorted correctly at Evernote. Same thing for Toodledo, etc.

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?

Author:  Daevien [ Sun Sep 25, 2011 4:22 pm ]
Post subject: 

Have you looked at the library?

http://library.linode.com/search?query=smtp

Author:  hoopycat [ Sun Sep 25, 2011 5:38 pm ]
Post subject: 

I generally use Postfix for mail stuff, so I'd lean towards that. Something I threw up awhile back to change the envelope sender of forwarded mail (to avoid tripping out SPF) defined a transport:

/etc/postfix/virtual
Code:
...
rtucker@example.com rtucker+example_com@gmail.com.munger
...


/etc/postfix/transport
Code:
.munger   munger:


/etc/postfix/main.cf
Code:
munger_destination_recipient_limit = 1


/etc/postfix/master.cf
Code:
...
munger  unix  -       n       n       -       -       pipe
  flags=q user=nobody argv=/etc/postfix/redirector ${mailbox}@${nexthop} ${original_recipient}
...


/etc/postfix/redirector
Code:
#!/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)"


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 work@en.example.com would add #work, etc.

Or, search for docs on setting up postfix+procmail and someone'll probably have your use case ready to roll. :-)

Author:  FunkyRes [ Sun Sep 25, 2011 10:26 pm ]
Post subject: 

Instead of munging subject lines, couldn't you just add a custom header you can use to filter with your client?

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/