I've now spent 2 hours trying to figure out this issue and I am about to give up and go to bed. I've been having issues with Gmail rejecting emails from my VPS server because of false spam alerts (probably caused by lfd sending too many emails).

So I changed my Exim config to send emails from a different IP (my VPS comes with 3) and that fixed the issue. I also enabled DKIM and SPF on my domains for added measure. But now, all my emails appear as ("From: Sender Name via server.domain1.com") where server.domain1.com is my VPS hostname. I previously had the same issue in Outlook and turning off "Set SMTP Sender: headers" solved that problem. But I believe adding the DKIM and SPF now makes Gmail add "via server.domain1.com" to my messages. How do I fix this?

This is a typical header for a message (as it appears at gmail):

Delivered-To: user@gmail.com
Received: by with SMTP id f3csp248622oem;
        Thu, 29 Mar 2012 21:23:18 -0700 (PDT)
Received: by with SMTP id gw8mr452788igb.10.1333081398523;
        Thu, 29 Mar 2012 21:23:18 -0700 (PDT)
Return-Path: <account@server.domain1.com>
Received: from domain2.com ([X.X.X.X])
        by mx.google.com with ESMTPS id y1si810998igb.3.2012.
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 29 Mar 2012 21:23:18 -0700 (PDT)
Received-SPF: pass (google.com: domain of account@server.domain1.com designates X.X.X.X as permitted sender) client-ip=X.X.X.X;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of account@server.domain1.com designates X.X.X.X as permitted sender) smtp.mail=account@server.domain1.com; dkim=pass header.i=@server.domain1.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=server.domain1.com; s=default;
    h=Date:Message-Id:From:Content-type:MIME-Version:Subject:To; bh=wF8bBRgh01EYg4t5DAeVPv1Ps906UVIeRnQCb/HvSYw=;
Received:       (Exim 4.77)
       id 1SDTVE-0005HA-9Y   
    for user@gmail.com; Fri, 30 Mar 2012 00:31:56 -0400
To: user@domain2.com
Subject: Password Reset Request
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
From: Sender Name <sender@domain3.com>
Message-Id: <E1SDTVE-0005HA-9Y@server.domain1.com>
Date: Fri, 30 Mar 2012 00:31:56 -0400
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - server.domain1.com
X-AntiAbuse: Original Domain - domain2.com
X-AntiAbuse: Originator/Caller UID/GID - [507 504] / [47 12]
X-AntiAbuse: Sender Address Domain - server.domain1.com

I was able to find the answer here: http://blog.tekipad.com/2009/11/exim-and-multiple-domains-php-mail-function-and-junk-mail-issue/

Basically, you need add a 5th header to your PHP mail() call with the following: "-f[from_email_address]"

And also add a new variable to your exim configuration: trusted_users = [colon separated list of user IDs that can modify send from addresses]

Doing those two worked. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.