I have setup a postfix server and set the MX record, SPF, and DKIM up to attempt to have a virtual mail forwarder. (for instance me@mydomain.com should forward to myalias@gmail.com) All appears well in the logs but gmail can only receive mail sent with sendmail from the console, but not when forwarded by the virtual rules.
This works:
sendmail me@mydomain.com Test ctrl-d
and results in a mail.log of:
Dec 29 15:55:19 www postfix/pickup[27575]: D6D3BE19EC: uid=0 from=<root> Dec 29 15:55:19 www postfix/cleanup[27580]: D6D3BE19EC: message-id=20131229205519.D6D3BE19EC@mail.mydomain.com Dec 29 15:55:19 www postfix/qmgr[27576]: D6D3BE19EC: from=root@mydomain.com, size=290, nrcpt=1 (queue active) Dec 29 15:55:21 www postfix/smtp[27582]: D6D3BE19EC: to=myalias@gmail.com, orig_to=me@mydomain.com, relay=gmail-smtp-in.l.google.com[74.125.137.26]:25, delay=3.6, delays=2.2/0/0.51/0.88, dsn=2.0.0, status=sent (250 2.0.0 OK 1388350521 t39si43670816yhp.150 - gsmtp) Dec 29 15:55:21 www postfix/qmgr[27576]: D6D3BE19EC: removed
and a e-mail on gmail with the following header:
Delivered-To: myalias@gmail.com Received: by 10.112.214.134 with SMTP id oa6csp248797lbc; Sun, 29 Dec 2013 12:55:21 -0800 (PST) X-Received: by 10.236.16.41 with SMTP id g29mr42719681yhg.17.1388350521272; Sun, 29 Dec 2013 12:55:21 -0800 (PST) Return-Path: root@mydomain.com Received: from mail.mydomain.com (www.mydomain.com. [x.x.x.x]) by mx.google.com with ESMTP id t39si43670816yhp.150.2013.12.29.12.55.20 for myalias@gmail.com; Sun, 29 Dec 2013 12:55:20 -0800 (PST) Received-SPF: pass (google.com: domain of root@mydomain.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 root@mydomain.com designates x.x.x.x as permitted sender) smtp.mail=root@mydomain.com; dkim=pass (test mode) header.i=@mydomain.com Received: by mail.mydomain.com (Postfix, from userid 0) id D6D3BE19EC; Sun, 29 Dec 2013 15:55:19 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mydomain.com; s=mail; t=1388350519; bh=g3zLYH4xKxcPrHOD18z9YfpQcnk/GaJedfustWU5uGs=; h=Date:From:From; b=HuJJBtPKQsF5VTwRWR7fhviOHX2gYlmqzK1P+kybHDEiFkWiFg1UfUGZX/LPprRO1 zlzupc4Hizp/7jPcqTcagkm0R+3NhKVR2n7xNDG4c7JO0V7EiW4CF0x689NzizwsSY IyrLprJu5PAlL6f7KXm0HScfi4l8pdrVkVEBMEpA= Message-Id: 20131229205519.D6D3BE19EC@mail.mydomain.com Date: Sun, 29 Dec 2013 15:55:17 -0500 (EST) From: root@mydomain.com (root)
test
When I send an e-mail to me@mydomain.com from gmail the following log results but no e-mail arrives in my gmail box or spam box:
Dec 29 15:57:46 www postfix/smtpd[27586]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled Dec 29 15:57:46 www postfix/smtpd[27586]: connect from mail-la0-f48.google.com[209.85.215.48] Dec 29 15:57:47 www postfix/smtpd[27586]: 25F9FE19EA: client=mail-la0-f48.google.com[209.85.215.48] Dec 29 15:57:47 www postfix/cleanup[27590]: 25F9FE19EA: message-id=CAEW7RRzFSJoBkiXsiq1kyi1XeTD_99bOR8_waFSmuK3xRv2zJw@mail.gmail.com Dec 29 15:57:47 www postfix/qmgr[27576]: 25F9FE19EA: from=myalias@gmail.com, size=1747, nrcpt=1 (queue active) Dec 29 15:57:47 www postfix/smtpd[27586]: disconnect from mail-la0-f48.google.com[209.85.215.48] Dec 29 15:57:48 www postfix/smtp[27591]: 25F9FE19EA: to=myalias@gmail.com, orig_to=me@mydomain.com, relay=gmail-smtp-in.l.google.com[74.125.137.26]:25, delay=1.5, delays=0.54/0/0.39/0.58, dsn=2.0.0, status=sent (250 2.0.0 OK 1388350668 v3si43678694yhd.138 - gsmtp) Dec 29 15:57:48 www postfix/qmgr[27576]: 25F9FE19EA: removed
The postfix/smtp is identical to the one that delivers properly from sendmail.
Closest question I’ve found is: https://www.digitalocean.com/community/questions/can-send-but-not-receive-email-centos-postfix But DKIM and SPF does not appear to be the problem based on the full header result show a spf=pass and dkim=pass.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Okay I think the issue is a gmail only silliness that organizes the email by the “Message-ID” field. So when it gets the e-mail forwarded back it just leaves the sent version and never delivers it to the inbox. <br> <br>To avoid this you have to add the account into gmail as an alias. (and not check not an alias)
Thanks a lot! I had the same problem and it was very frustrating.
Okay so I finally setup an e-mail account other than gmail and tried forwarding mail there and it works fine. I guess it must be something gmail specific. (Still don’t know what)
Okay I took it to a new level and sniffed the outgoing smtp session to see if it made it into google’s server: <br>tcpdump -l -s0 -w - tcp dst port 25 | strings <br> <br>It looks like it is sending it out so I’m not sure what gives: <br> <br>JEHLO mail.mydomain.com <br>UTJ} <br>cMAIL FROM:myalias@gmail.com SIZE=1755 <br>UTJ} <br>zRCPT TO:myalias@gmail.com <br>UTJ} <br>DATA <br>UTJ} <br>0Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) <br> by mail.mydomain.com (Postfix) with ESMTP id 6641FE19F6 <br> for me@mydomain.com; Mon, 30 Dec 2013 14:20:49 -0500 (EST) <br>Authentication-Results: mail.mydomain.com; dkim=pass <br> reason=“2048-bit key; insecure key” <br> header.d=gmail.com header.i=@gmail.com header.b=mxTtCKp6; <br> dkim-adsp=pass; dkim-atps=neutral <br>Received: by mail-lb0-f181.google.com with SMTP id q8so5827277lbi.12 <br> for me@mydomain.com; Mon, 30 Dec 2013 11:20:48 -0800 (PST) <br>DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; <br> d=gmail.com; s=20120113; <br> h=mime-version:date:message-id:subject:from:to:content-type; <br> bh=ppUKk8ESYlJZsRuZ0cEXf7GqUyAxDklN/LCG1aC8bgk=; <br> b=mxTtCKp60FlT0FvNYDXdydHo8+bt7tjZKA59wKnEaE4zcSNUA56A2ONazXPLCv77eD <br> kGXIp4I7HKICKkqSlmm9janyhJZFzMSwm0yNggItnBLgwuT5Yy38qc0I2WL2FxC2hZgc <br> FDl56rFU3780tLG4qnqbVuO9rp+S0g42zBYPVrK8tU6+ZXXMJEk268FFbUHemWPyO9ra <br> ytGmrloaqYtVknJXtwepqM2lfc5BIYUANMQQTHnlEpYwPg6dcEvPgE4CXb95xZ58Wz5p <br> +dA7vrc6ctUQgP+0hmyGab2RcKl14zeg70xkoJPdt1kdS13kQaM75HZ03zvuBSAhgcg/ <br> p46w== <br>MIME-Version: 1.0 <br>X-Received: by 10.112.12.229 with SMTP id b5mr585009lbc.90.1388431248317; Mon, <br> 30 Dec 2013 11:20:48 -0800 (PST) <br>Received: by 10.112.214.134 with HTTP; Mon, 30 Dec 2013 11:20:48 -0800 (PST) <br>Date: Mon, 30 Dec 2013 13:20:48 -0 <br>UTJ} <br>0600 <br>Message-ID: CAEW7RRzbFyF4d1AGQHyBwNDsC-fxPJSPsTrvm9QEcpEvHuV8WA@mail.gmail.com <br>Subject: s <br>From: Michael Johnson myalias@gmail.com <br>To: me@mydomain.com <br>Content-Type: multipart/alternative; boundary=001a11c39c4659e35404eec557a9 <br>–001a11c39c4659e35404eec557a9 <br>Content-Type: text/plain; charset=ISO-8859-1 <br>–001a11c39c4659e35404eec557a9 <br>Content-Type: text/html; charset=ISO-8859-1 <br><div dir=“ltr”>s<div><br></div></div> <br>–001a11c39c4659e35404eec557a9– <br>UTJ} <br>^QUIT <br>UTJ} <br>UTJ} <br> <br> <br>
It does not show up in the spam filter. Based on the mail from root it appears that SPF and DKIM are both working so I would think it is something pretty bad to make it reject it outright. Of course all I have to go on that suggest it’s going out is the postfix/smtp line that says sent.
Did you check your Spam folder? Is the email there or do you not receive it <strong>at all</strong>?