Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For years and years, I've been running my own email server on my home network. Thanks to getting a Nexus 4, I've finally switched everything over to Google, and decommissioned my email server. Now I'm having trouble getting administrative emails (think logwatch, RAID health checks, and the like) delivered out to my Google account.

I have a single internal relay which bounces email out to the world through Comcast's SMTP relay. So I can send email to my account on Gmail, but it will all look like it came from a single address. What I can't seem to sort out is a way to tell which machine the email came from. I have a "proper" network at my house, with an internal domain name and name server. I'd like to be able to see email come into my Gmail account with a {user}@{machine}.{domain} address, but Comcast won't deliver mail with my a local machine + domain name. Failing this, I tried using {machine}@{domain}, but this was also failing with my internal domain name.

I can fake mail to look like it's coming from my actual, real domain, but I was still losing the machine information.

I suppose more options open up if I use my real Gmail credentials, send straight to Google's SMTP server(s), and bypass Comcast's? I'd probably have the same trouble with my internal domain with their servers, though.

I was fooling with nullmailer, ssmtp, and postfix. I know I could work out the simplest working solution through trial and error, but I also know that will take many more hours of screwing around. Someone's bound to have sorted out something clever for this, but I can't seem to find anything through Google. This is probably a dupe, but I couldn't find anything even close on SuperUser or ServerFault.

Maybe it's time to take out another real domain? I'm pretty partial to this one. Or maybe I could use my DyDNS name internally? Comcast and/or Google may respect that one.

share|improve this question
Why don't you add the necessary information to the subject line? – terdon Feb 10 '13 at 16:16
Sorry, but I don't understand what you want me to add. – David Krider Feb 10 '13 at 16:37
Well, the point here is to have emails delivered to your gmail address with specific information encoded in the From line. You want to know which machine/user sent the mail and would like that information to be user@machine. Can't you get the same information by having each machine send mails with a specific subject line? – terdon Feb 10 '13 at 16:41
That's a good enough idea to warrant an actual answer. (I thought you meant the subject of this post on!) Postfix could probably rewrite the subject lines somehow... – David Krider Feb 10 '13 at 23:05
up vote 1 down vote accepted

Another option might be to tweak the To: address using extended addressing. In an email address, Gmail ignores everything after a plus sign, so, and will all get delivered to

This is great for filter targets. For instance, I have a filter which automatically adds a star to anything from

So perhaps you can generate addresses like and then filter accordingly.

share|improve this answer
I like this idea for determining which machine sent the message, but I still have a problem with sending the mail looking like it comes from my internal domain. So this idea could save me the trouble of changing the Subject lines, but I still have to masquerade the domain somehow. Unfortunately, it would seem that the "masquerade" Postfix directive only gets rid of the hostname from the FQDN. I'm having trouble configuring something stronger. – David Krider Feb 11 '13 at 17:46
I have it all setup to masquerade my internal machines to my single domain name, then use smtp_generic_maps to rewrite any addresses it gets to a dynamic (but still real) domain name I use, then send to a "plus" address in the real world. – David Krider Feb 13 '13 at 4:16

Here you go then, comment as an answer.

In your place I would try and modify whatever program/script/service is sending the mails out to include the user and machine information in the subject line of the email. That should be much easier to set up and is equally amenable to gmail filters and labels and the like to allow for organization.

If you give some more information on the specific services that are sending the emails I should be able to help with the details.

share|improve this answer
Looks like you can rewrite Subject lines through Postfix's "header_checks" directive, and you can change the From addresses through "smtp_generic_maps". I'm still trying to get these configured correctly. – David Krider Feb 11 '13 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .