Postfix mydestination question
Mine in my main.cf looks like this (domain names faked so that if I have a big hole in the server I'm not pointing spammers at my server):
#this resolves to the mail server
myhostname = liXX-XX.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
# this is a debian system, and this file has an entry liXX-XX.members.linode.com
myorigin = /etc/mailname
mydestination = liXX-XX.members.linode.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
I have a few virtual domains & mailboxes that PHP is sending email to users from, and I've got them listed as follows:
virtual_mailbox_domains = example.net, example.com
virtual_mailbox_base = /mail
virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtualmailboxes.cf
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:100
virtual_alias_maps = mysql:/etc/postfix/mysql/virtualaliases.cf
My question relates to the email headers that are sent with the email from my PHP scripts. In the header, as expected based on the above settings, a few of the headers are as follows:
Return-Path: <www-data@lixx-xx.members.linode.com>Received: by liXX-XX.members.linode.com (Postfix, from userid 33)</www-data@lixx-xx.members.linode.com>
So, it would be great to be able to have the return-path be the same email account that is sending the email via PHP (specified in the email from, reply-to headers) for each virtual domain (i.e.
Second question, the Received field indicates the hostname of the server. Again, would be great to have this be the same domain as the virtual domain that sends the email, rather than the linode domain name… again, is this possible with virtual domains?
Thanks for any info,
Paul
5 Replies
@pmmenneg:
it would be great to be able to have the return-path be the same email account that is sending the email via PHP (specified in the email from, reply-to headers) for each virtual domain (i.e.
webmaster@example.com ,listmaster@eample.net , etc) rather than the default PHP user with the full path to the server (the linode dns path).
Check out the php mail docs – you can set the From: header either individually in the additional_headers, or globally via php.ini.
@pmmenneg:
Second question, the Received field indicates the hostname of the server. Again, would be great to have this be the same domain as the virtual domain that sends the email, rather than the linode domain name… again, is this possible with virtual domains?
Easy enough on Exim, but not sure of the best way on Postfix. Undoubtedly someone else will pipe up.;)
But yes, you are probably correct in thinking that it's a Postfix/MTA issue.
paul
@pmmenneg:
Figured it out I believe. Passing Postfix the sender email via the -f parameter from the PHP mail() function changed the sender envelope so that the email now appears to originate from the actual sender.
paul
Actually, this just solved the issue related to the destination, but not the other 'issue' related to the mail server domain from Postfix's myhostname setting.
Anyone aware of a way to have the Postfix MTA domain set to your virtual domain (say mx.example.com, mx.example.net, etc all of which would resolve to the server and would be a FQDN) rather than having it hardcoded to a single 'universal' domain name?
Thanks,
Paul