-3

I have an issue where sending e-mail from our Ubuntu server to a Google Group account no longer works and results in the Google group rejecting the e-mail. (Please note that when I say Google Groups, I don't mean groups.google.com, but rather a group set up in my Gmail account console). This used to work and has only recently (in the last 2 weeks) stopped working. Now when mail is attempted to be sent the following error is shown in /var/log/mail.log :

Mar 19 15:36:04 server217-174-255-91 postfix/pickup[11890]: D60AF40066A: uid=33 from=<www-data>
Mar 19 15:36:04 server217-174-255-91 postfix/cleanup[12498]: D60AF40066A: message-id=<20150319153604.D60AF40066A@server217-174-255-91.live-servers.net>
Mar 19 15:36:04 server217-174-255-91 postfix/qmgr[11968]: D60AF40066A: from=<www-data@demo.XXXourwebsiteXXX.com>, size=439, nrcpt=1 (queue active)
Mar 19 15:36:04 server217-174-255-91 postfix/smtp[12499]: connect to ASPMX.L.GOOGLE.com[2a00:1450:400c:c03::1b]:25: Network is unreachable
Mar 19 15:36:05 server217-174-255-91 postfix/smtp[12499]: D60AF40066A: to=<support@XXXourwebsiteXXXX.com>, relay=ASPMX.L.GOOGLE.com[64.233.166.27]:25, delay=0.27, delays=0.05/0.01/0.06/0.15, dsn=2.0.0, status=sent (250 2.0.0 OK 1426779365 jf1si3669888wic.51 - gsmtp)
Mar 19 15:36:05 server217-174-255-91 postfix/qmgr[11968]: D60AF40066A: removed
Mar 19 15:36:05 server217-174-255-91 postfix/smtpd[12462]: connect from mail-we0-f196.google.com[74.125.82.196]
Mar 19 15:36:05 server217-174-255-91 postfix/smtpd[12462]: NOQUEUE: reject: RCPT from mail-we0-f196.google.com[74.125.82.196]: 454 4.7.1 <www-data@demo.XXXXourwebsiteXXXX.com>: Relay access denied; from=<> to=<www-data@demo.XXXXourwebsiteXXXX.com> proto=ESMTP helo=<mail-we0-f196.google.com>
Mar 19 15:36:05 server217-174-255-91 postfix/smtpd[12462]: disconnect from mail-we0-f196.google.com[74.125.82.196]

The sending of the mail is via PHP and is like the following:

mail("mygroup@ourGmailDomain", "Subject", "Message", "Header");

If I change my PHP to use an individual users account and not a group, then it works and the e-mail is received. So the following code does work and the user "aPerson" receives the e-mail:

mail("aPerson@ourGmailDomain", "Subject", "Message", "Header");

What am I doing wrong? What is special about the group that is causing the e-mails to be rejected whereas sending to an individual Gmail account causes the mail to be accepted?

Update with my findings:

This issue has now been resolved. I believe that the issue was to do with the mail being sent having a bad or invalid header. The mail was being sent by the user www-data but within the header we had added "from: " and then another user. I believe that Google had updated their policy on sending to a group and so because the e-mail had a header that didn't match the e-mail address it was sent from, then this was the cause of rejection.

By removing the header from the PHP mail send command, I can now send e-mails to the group. Whilst investigating I also performed the following

  • Added the full domain name to my DNS "MX" registration
  • Modified the file: "/etc/postfix/main.cf" so that the inet_protocols were set to ipv4 only.

Thanks to everyone who offered advice.

Phil
  • 109
  • 2
  • 8
  • 1
    if you want to track a particular message, you'll need to focus on the message number that appears in parens. so if you filter / grep for [12499], you'll see the sequence of actions for that message. btw, "removed" means the message was removed from the server. – LHWizard Mar 19 '15 at 16:20
  • Ok, thanks. So my messages are being attempted to send but for some reason they are being rejected. Could this be because the mail program on my Ubunutu server is incorrectly configured? – Phil Mar 19 '15 at 16:48
  • 1
    no, your mails are being sent `status=sent (250 2.0.0 OK 1426779365 jf1si3669888wic.51 - gsmtp)` but the replies (or bounce messages) are being rejected. You need to see why your emails are not being delivered to the group - maybe your server has been blacklisted? – LHWizard Mar 19 '15 at 17:55
  • Questions must demonstrate a **minimal understanding of the problem being solved**. Try including attempted solutions, why they didn't work, and the *expected* results. See [How can I ask better questions on Server Fault?](http://meta.serverfault.com/q/3608/118258) for further guidance. – HopelessN00b Mar 20 '15 at 13:58
  • I'm confused. Why didn't I demonstrate a "minimal understanding of the problem" ? I did not know where the problem(s) lay and tried to be clear in explaining my scenario. I investigated and tried using a different email account (see paragraphs 6 and 7 of my original question) and I stated that an individual account works but that a Group account didn't. Expected results would have been the arrival or not of the e-mail to my account which I think is fairly obvious. I thought it would be helpful to include the error log and this did prove so (see @LHWizard's comment above). – Phil Mar 20 '15 at 15:03

1 Answers1

1

Google is trying to send you a bounce message in response to the email that you delivered to them. But since your email doesn't have a valid from address, it can't be delivered to you.

Fix your application so that it sends email with a valid address.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Interesting. I am a complete noob at this. I think I am using GNU mail. How do I configure this? Is there a file somewhere? – Phil Mar 19 '15 at 16:59
  • I *think* you were right, so I've marked you as the accepted answer. See the edits to my original question. – Phil Mar 20 '15 at 11:39