Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Oct 19, 2009 10:51 pm 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
Having looked at the Postfix documentation, it looks like the standard practice for Postfix configuration is to have your mydestination entry point to your localhost:

http://www.postfix.org/postconf.5.html#mydestination

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):

Code:
#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:

Code:
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:

Code:
Return-Path: <www-data@liXX-XX.members.linode.com>
Received: by liXX-XX.members.linode.com (Postfix, from userid 33)


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. webmaster@example.com, listmaster@eample.net, etc) rather than the default PHP user with the full path to the server (the linode dns path). But since I can't specify virtual domains in mydestination, is this even possible?

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


Top
   
PostPosted: Mon Oct 19, 2009 11:26 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
pmmenneg wrote:
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 wrote:
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. ;)


Top
   
 Post subject:
PostPosted: Mon Oct 19, 2009 11:33 pm 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
I have set the From, Reply-To in the additional headers... Return-Path is the one I'd like to 'clean up' if possible, but thought that was likely more of a Postfix issue than PHP. I've tried setting it from PHP and no luck.


Top
   
 Post subject:
PostPosted: Tue Oct 20, 2009 12:12 am 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Fair enough. My assumption had been that you weren't setting anything in mail(), and hence that your MTA was then cleaning up the headers (inserting defaults) in their absence. Presumably you put \r\n, or similar between the headers, and have tried the -f option also.

But yes, you are probably correct in thinking that it's a Postfix/MTA issue.


Top
   
 Post subject: Figured it out, I think
PostPosted: Tue Oct 20, 2009 10:04 am 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
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


Top
   
PostPosted: Tue Oct 20, 2009 11:48 am 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
pmmenneg wrote:
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group