A slightly long-winded hint, but one that I think lots of you out there will find quite useful. Firstly though, why am I interested in changing how my email address looks depending on where it gets sent to? Am I an aspiring spammer, plotting to convince you that your Mac will be plagued by viruses unless you buy lots of v1agra from me?
Not at all! The reason is this: I have a domain. They are fairly cheap to buy and have a feature such that any_email@yourdomain.address will be caught and forwarded to the same 'catch-all' address. Whenever I contact a company, I like to say that my address is TheCompanyName@MyDomain.com, particularly if they are not a reputable company. That way, if they sell my email address to a spammer (or whatever), it is only their specific address that is compromised, and that can easily be configured to reject all mail via your domain host. I also find it useful for advanced searching: all of my eBay correspondence (i.e. eBay, PayPal, and whoever I buy/sell from) use the same address on my domain, so I can quickly check out my eBay activity despite that fact that these people may have nothing else in common.
But now onto the crux of the hint ... if I use Mail to send an email to DodgyCompany Inc, how do I make it look like the message is indeed from dodgy@MyDomain.com? I could go into Mail's account preferences and change the From text. Or I could have a different account set up for each company that I send to. But both of these ideas are quite tiresome for anything other than a one-off. Besides, this kind of mail manipulation is bread and butter stuff to Unix, and guess what lurks under the hood of our friendly Macs?
Now, we are briefly going to dabble in the nasty Unix world, but not for long; hence why I didn't mark this hint in the Unix category. We will be using postfix to send email (there are already plenty of fine hints, not to mention the Postfix Enabler, to get you going with this, so I won't go into the details here). Then we are going to use a tool called procmail (already installed on your Mac) to alter the emails.
Start by opening Finder and then press Shift-Command-G to get the Go to Folder dialog, and type in /etc/postfix, then press Return. Create a copy of master.cf somewhere safe! Now click on master.cf and press Command-I (Get Info). In the Info window, expand the Ownership & Permissions section, and then the Details to view the owner of the file. Change the owner to be yourself (you will need to provide an administrator password to do this). Now click on a blank part of the folder and do the same again (i.e. press Command-I and change the owner to be yourself) and then open master.cf in TextEdit.
This file looks nasty but don't worry! We need to change two small parts. First look (about halfway down the file) for a line like this:
smtp inet n - n - - smtpd
Now add the following directly beneath:
-o content_filter=filter:dummy
When done, the two lines should look like this:
smtp inet n - n - - smtpd
-o content_filter=filter:dummy
One more change to go! Add the following to the bottom of the file (replace joebloggs with your actual user name):
filter unix - n n - 10 pipe
flags=Rq user=joebloggs argv=/usr/bin/procmail /Users/joebloggs/.mailrecipe
Now save master.cf, open up the info windows on both the master.cf file and its folder, and change the owner back to system.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060820100312135