2

I hope someone might have an idea on this. I'm running a Magento website on an Amazon Linux server (basically CentOS) with an Apache webserver. I also use Google Apps for managing mydomain.com's mail.

I was able to successfully set up the MX, SPF and DKIM records for the server and got them working, so that I receive a "Pass" for both SPF and DKIM when I send emails. However, I've run into a strange problem I can't seem to get past --- part of the headers for the emails I send always says:

Received: (from apache@localhost) by mydomain.com 

I've searched high and low for a way to change this to use "mail@mydomain.com" instead, but I just can't seem to figure it out.

Among things I've tried:

  • Changing the php.ini to say: /usr/sbin/sendmail -t -i -f mail@mydomain.com
  • Adding to mydomain.conf's virtualhost the line: ServerAdmin mail@mydomain.com
  • Setting the Return-Path to "Yes" in the Magento backend (System -> Configuration -> Advanced -> System -> Mail Sending Settings.

I'm not sure if there's anything else that might be affecting the mail sends. If anyone has an idea it would be much appreciated, thank you!

Edit: The contents of my /etc/hosts file are as follows:

127.0.0.1   www.mydomain.com
127.0.0.1   mydomain.com
127.0.0.1   localhost localhost.localdomain

Edit 2: I thought it might help if I added the headers of the email, in case that might give some clues to what might be going on (I've changed a lot of values to keep it generalized).

Delivered-To: zerowing@email.com
Received: by 123.123.123.123 with SMTP id abcdefg123456790;
        Fri, 3 Apr 2015 08:35:04 -0700 (PDT)
X-Received: by 456.456.456.456 with SMTP id asdfqwerhjkl234hjkl.789.78909876789;
        Fri, 03 Apr 2015 08:35:03 -0700 (PDT)
Return-Path: <mail@mydomain.com>
Received: from mydomain.com (ec2-11-11-111-11.amazonaws.com. [66.66.777.77])
        by mx.google.com with ESMTPS id asdkfjhkjdfha839383.105.2015.04.03.08.35.02
        for <zerowing@email.com>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 03 Apr 2015 08:35:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of mail@mydomain.com designates 66.66.777.77 as permitted sender) client-ip=66.66.777.77;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of mail@mydomain.com designates 66.66.777.77 as permitted sender) smtp.mail=mail@mydomain.com;
       dkim=pass header.i=@mydomain.com
Received: from mydomain.com (www.mydomain.com [127.0.0.1])
    by mydomain.com (8.14.4/8.14.4) with ESMTP id t33FZ29p004251
    for <zerowing@email.com>; Fri, 3 Apr 2015 15:35:02 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mydomain.com;
    s=default; t=fjIFDJF9049;
    bh=fjO4J4f09j409JF04J909f4j904JF940F9/Y=;
    h=To:Subject:From:Date;
    b=F4J90FJ490j09j490FJ094J0j94f90j409j490Jf90j904JF09j490fj904jf094J
     f09J40F9J904fj049J099j49J049J0FJijffjdlfjldkDLFJKLdjflEJFOIJFOEIEO
     JF9JF049j409j0F094J09FJ049jf049j=
Received: (from apache@localhost) <----------- THIS IS WHAT I'M TRYING TO CHANGE
    by mydomain.com (8.14.4/8.14.4/Submit) id fkdjfljlfsra39393;
    Fri, 3 Apr 2015 15:35:01 GMT
Message-Id: <201504031535.fkdjfljlfsra39393@mydomain.com>
To: =?utf-8?B?Sm9lIEdhcmNpYQ==?= <zerowing@email.com>
Subject: =?utf-8?B?VGVzdCBOZXdzbGV0dGVyLCBwbGVhc2UgaWdub3Jl?=
X-PHP-Originating-Script: 48:Sendmail.php
From: "mydomain.com" <mail@mydomain.com>
Date: Fri, 03 Apr 2015 15:35:01 +0000
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
  • you need to go to: System -> Configuration -> Advanced -> System ->Set Return-Path -> Yes or w/e email address you want it to be. Just found it today. It's ridiculous that this is not a default setting for Magento. – Kalvin Klien Jul 8 '15 at 17:29
1

If you are using Google Apps, I'd recommend installing SMTP Pro. It'll allow you to configure it so that email is sent from Google Apps, and not directly from your server. This will resolve your issue.

0

I presume your etc/hosts says the following:

127.0.0.1 localhost mydomain.com 

Change it to

127.0.0.1 mydomain.com localhost 
  • I decided to give this a try just now, but unfortunately the result was still the same. My file actually had a few lines of settings inside already, I'll add the contents back into my question. – Zero Wing Apr 2 '15 at 21:13

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.