I am now working at a place where I get a chance to home my php, javascript and mysql skills, work with cake and other similar projects The job has System Admin work also and it is fun since I get to learn lots of new things. At the moment, I am just being given debugging and troubleshooting to do on the servers, but it is a matter of time before I impress and blow my team leader away.
Meanwhile, one issue that came up was a client with a server that had multiple domains on it. While sending mails with php’s mail function, the Received and other headers were not being set correctly, because of which mails to hotmail and live.com were ending up in the junk folder.
For eg.
Return-Path: <admin@correct.com> Received: from noc.wrong.com ([76.76.11.105]) by mx.google.com with ESMTP id 42si3780510ywh.71.2009.; Wed, 11 Nov 2009 22:59:31 -0800 (PST) Received-SPF: neutral (google.com: .......; Authentication-Results: mx.google.com; ....... Received: from wronguser by noc.wrong.com with local(Exim 4.69) (envelope-from <admin@wrong1.com>)ntid 1N8TeT-0007On-F6ntfor jebasingh.emmanuel@gmail.com ; Thu, 12 Nov 2009 01:59:29 -0500
See the envelope-from? That was not being set properly event by using the 5th parameter in php mail as ‘-fadmin@correct.com’
The fix for that was easy, set
trusted_users=domainusername
in /etc/exim.conf.
The trusted_users variable is a colon delimited list of user accounts whose domains should be allowed to send mail as themselves.
Now for the actual code fixes, which can be found here.
General Exim method which doesn’t exactly work as advised. Might need modifications.
The problem with the first method was that $interface_address was not set at all for outgoing mail. Since we do not receive incoming mail for our domains, I didn’t get to check how the incoming mails were working out. If you are using WHM, however, you just need to create the files /etc/mailhelo and /etc/mailips and you are good to go after restarting exim. (test with exim -bV first)
I get these headers after the edit.
Return-Path: <admin@correct.com>
Received: from correct.com ([76.76.11.105])
by mx.google.com with ESMTP id 42si3780510ywh.71.2009.;
Wed, 11 Nov 2009 22:59:31 -0800 (PST)
Received-SPF: neutral (google.com: …….;
Authentication-Results: mx.google.com; …….
Received: from correctuser by noc.wrong.com with local(Exim 4.69)
(envelope-from &lt;admin@correct.com&gt;)ntid 1N8TeT-0007On-F6ntfor jebasingh.emmanuel@gmail.com ; Thu, 12 Nov 2009 01:59:29 -0500</pre>
Couldn’t figure out how to set the smtp_active_hostname in exim.conf since $interface_address wasn’t being set. Still, the mails no longer end up in the junk mail folder on gmail, yahoo, aol and hotmail, so I think I am golden.
Took ages to get the above links. Just hope it helps someone else too.
great work dude!! keep more coming.