3

(I posted this on Superuser but I realized that it was probably better handled here)

I've recently set up a development server at my job to test out certain features. I am setting up exim4 to be the MTA for the server. However, when I test and send emails to my account on the server, even though I have multiple entries in /etc/aliases it only sends to one of the email addresses.

The entry is my /etc/aliases file is:

joshua: **@gmail.com, **@apps.gmail.com

Below is the output of tail /var/log/exim4/mainlog. I've changed the email addresses, but the rest of the data is the same. **@gmail.com is my regular gmail account, **@apps.gmail.com is a Google apps account for my job, and [email protected] is the server's domain name.

2013-02-04 02:39:55 1U2Geh-0000aO-LZ DKIM: d=gmail.com s=20120113 c=relaxed/relaxed a=rsa-sha256 [verification succeeded]
2013-02-04 02:39:55 1U2Geh-0000aO-LZ <= **@gmail.com H=mail-wi0-f179.google.com [209.85.212.179] P=esmtp S=1757 id=CAM+SEUAx2UK8cDKe-MO22maib0at4kO=J+tQniEy=rxmPpbgjg@mail.gmail.com
2013-02-04 02:39:56 1U2Geh-0000aO-LZ => **@apps.gmail.com <[email protected]> R=dnslookup T=remote_smtp H=aspmx.l.google.com [2607:f8b0:4002:c04::1b] X=TLS1.2:RSA_ARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2013-02-04 02:39:56 1U2Geh-0000aO-LZ => **@gmail.com <[email protected]> R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [2607:f8b0:4002:c02::1b] X=TLS1.2:RSA_ARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2013-02-04 02:39:56 1U2Geh-0000aO-LZ Completed

When I send a test email, it sends to my apps email address but not my gmail address.

I thought it might be an issue with exim4 not sending to multiple email addresses, so I changed the /etc/aliases file to only reflect my **@gmail.com email address but it also failed to send even though there were no specific errors in the mainlog.

I also tested to see if I could send emails directly to my gmail account. I ran the command

echo "Test" | mail -s "Subject" "**@gmail.com"

and it succeeded.

Basically, when I send an email to [email protected] it successfully sends an email to **@apps.gmail.com but not **@gmail.com. However, when I send an email directly to **@gmail.com it goes through. Any ideas?

UPDATE: I was messing around with /etc/sudoers.d and accidentally made an invalid file, and sudo wouldn't work until I fixed it. I set up sudo to send emails when errors occur. When an error occurred, it sent an email to [email protected] which sent an email to my email address. I tested by sending an email directly to [email protected] but it still did not send to my email address. Here is the mainlog

2013-02-04 10:13:39 1U2Njn-0000gc-UB <= [email protected] U=joshua P=local S=572
2013-02-04 10:13:40 1U2Njn-0000gc-UB => **@gmail.com <[email protected]> R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [2607:f8b0:4002:c04::1a] X=TLS1.2:RSA_ARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2013-02-04 10:13:40 1U2Njn-0000gc-UB Completed
2013-02-04 10:23:10 1U2Nt0-0000gz-Kz DKIM: d=gmail.com s=20120113 c=relaxed/relaxed a=rsa-sha256 [verification succeeded]
2013-02-04 10:23:10 1U2Nt0-0000gz-Kz <= **@gmail.com H=mail-we0-f171.google.com [74.125.82.171] P=esmtp S=1737 id=CAM+SEUDYoGWBb1btq_WQ9gRcWbvoSOoBhr2XrA=8QPbCsreLSg@mail.gmail.com
2013-02-04 10:23:11 1U2Nt0-0000gz-Kz => **@gmail.com <[email protected]> R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [2607:f8b0:4002:c04::1b] X=TLS1.2:RSA_ARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2013-02-04 10:23:11 1U2Nt0-0000gz-Kz Completed

The first entry is the email that sent correctly (when I attempted to sudo with an invalid sudoers.d file) and the second entry is the test email I sent to [email protected].

UPDATE 2: These are the headers I receive when I get a successful email to my Gmail account:

Delivered-To: **@gmail.com
Received: by 10.216.72.209 with SMTP id t59csp48841wed;
        Mon, 4 Feb 2013 07:34:59 -0800 (PST)
X-Received: by 10.101.175.18 with SMTP id c18mr7560000anp.3.1359992098647;
        Mon, 04 Feb 2013 07:34:58 -0800 (PST)
Return-Path: <[email protected]>
Received: from this.server ([2607:fe50:0:6200:206:5bff:fefc:6123])
        by mx.google.com with ESMTPS id i16si8003851anl.12.2013.02.04.07.34.58
        (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
        Mon, 04 Feb 2013 07:34:58 -0800 (PST)
Received-SPF: neutral (google.com: 2607:fe50:0:6200:206:5bff:fefc:6123 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=2607:fe50:0:6200:206:5bff:fefc:6123;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 2607:fe50:0:6200:206:5bff:fefc:6123 is neither permitted nor denied by best guess record for domain of [email protected]) [email protected]
Received: from joshua by this.server with local (Exim 4.80)
    (envelope-from <[email protected]>)
    id 1U2O4i-0000hR-Je
    for [email protected]; Mon, 04 Feb 2013 10:35:16 -0500
To: [email protected]
Auto-Submitted: auto-generated

2 Answers 2

1

Your Exim log seems to be indicating that the mail was correctly sent to the **gmail.com address:

2013-02-04 02:39:56 1U2Geh-0000aO-LZ => **@gmail.com <[email protected]> R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [2607:f8b0:4002:c02::1b] X=TLS1.2:RSA_ARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"

Have you looked in the Exim Reject log as well? Although there's doubtful to be anything there if the main log doesn't indicate any failure.

Generally in these situations, if there's no indication in the mail log as to a failure in message delivery, it's really hard to troubleshoot on the server end. In these cases it's almost always an issue with the receiving server discarding the message for one reason or another. I've seen this happen with Gmail quite often. My recommendations:

  • Have you checked the Exim queue as well to ensure the messages are actually being sent?

exim -bp

  • Does your domain have an SPF record set up? If not, I would definitely recommend doing so.

  • You could check if your IP is on a blacklist (I like to use MXtoolbox). However, this isn't guaranteed to fix anything, since Google isn't public on what blacklists they use (and I believe they keep private ones anyway.)

  • Gmail in particular doesn't always get along with email forwarding. An alternative is rather then having your alias forward the email to Gmail, setting up that Gmail account to pick up the email over POP. You can do that as follows:

Gmail -> Gear -> Settings -> Accounts -> Add a POP3 mail account you own.

Sorry I can't offer more than this. I've dealt with similar issues dozens of times, and these are the only things that have ever helped. If there's no indication of an error on the server end, then it's really hard to figure out the issue if you don't have access to the receiving server as well. (And as this is Google, there isn't going to be any help coming from their end.)

7
  • There aren't any messages sitting in the queue, so I don't think it's an issue concerning that. I don't understand why sending mail directly through mail server-side would work, but sending an email to [email protected] or [email protected] via Gmail would fail. It's not that it's getting flagged as spam; it's not showing up at all...
    – josh
    Feb 4, 2013 at 15:51
  • Yeah, makes sense. If there was, there would likely be some indication of that in your exim logs.
    – Nate
    Feb 4, 2013 at 15:52
  • See my updated comment above. Also, do you know if Gmail sends any emails it gets on its blacklist to spam, or just outright blocks the emails from ever sending to the user?
    – josh
    Feb 4, 2013 at 15:56
  • That is strange that it seems to only fail with the alias. Hm... As far as the blacklisting, they seem to do both. It's hard to tell, though, because as far as I know they're not public with the procedures they use for blacklisting/spam filtering.
    – Nate
    Feb 4, 2013 at 16:04
  • Would it be helpful to have the headers I receive from when I send the email through mail to my Gmail account?
    – josh
    Feb 4, 2013 at 16:06
0

The issue was what Todd Lyons stated in the comments: It occurred because Gmail de-duplicates emails originating from the same email address. When I was sending the emails, they were sending straight through as my own email, and when it sent back to my Gmail it was removed as it would have been a duplicate.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .