Jimmy's weblog


Postfix: Faking the From header (not From:)

Filed under: — jimmy @ 7:28 pm

I never send mail over my main server, I always send over my local gateway or sometimes from my notebook. This is usually no problem but some mailservers and auto responders send mails to the address in the From header, which might me different than the address in the From: header. For better understanding: The From: is usually set by the mail client and the From is usually set by your mailserver. Default value for From is your username and the hostname of the machine. So in my case it’s jimmy@ultimate.g-tec.co.at. But I only receive mails for my domain g-tec.co.at, not for ultimate.g-tec.co.at. Every mailserver has a couple of ways to rewrite its headers, in postfix it’s done by masqerading, in this case.

masquerade_domains = g-tec.co.at

This line (in /etc/postfix/main.conf) now strips off all the hostnames that I use on my machines. So ultimate.g-tec.co.at becomes g-tec.co.at and the From is now “jimmy@g-tec.co.at”.
Works perfectly :-)