Gmail Issue

We have started getting email bounces from Gmail when messages are sent from internal. The message is returned with:

Technical details of permanent failure:

550-5.7.1 [199.181.239.189 11] Our system has detected that this message is not RFC 5322 compliant: ‘From’ header is missing. To reduce the amount of spam sent to Gmail, this message has been blocked. Please visit https://support.google.com/mail/?p=RfcMessageNonCompliant and review RFC 5322 specifications for more information. c130si6503762oib.182 - gsmtp

It looks like a ‘From’ header is required. Is this in the system, or needed to be added?

Hi, Have you set ‘From’ address on email or email template you use ?

The emails are generated when we send a message using the internal messaging system. For example, when we ‘post’ a update, that same message is also sent as a email.

I notice that when there is just one recipient it works just fine, but not with a number of recipients.

Which version of axelor open suite and axelor platform are you using ? Did you configured default EmailAccount properly from ‘Email Accounts’ menu ?

Both are Version: 5.2.2.
Email account set up is fine and working as expected.
Here is a complete message header as rejected by gmail…

Reporting-MTA: dns; qrelay137.mxroute.com
X-ZoneMTA-Queue-ID: 1700922339d000f036
X-ZoneMTA-Sender: rfc822; hr@xxxxx.com
Arrival-Date: Mon, 03 Feb 2020 03:40:01 +0000

Final-Recipient: rfc822; xxxxxxxx@gmail.com
Action: failed
Status: 5.0.0
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.1 [172.82.139.137 11] Our system has detected that this message is not RFC 5322 compliant: ‘From’ header is missing. To reduce the amount of spam sent to Gmail, this message has been blocked. Please visit https://support.google.com/mail/?p=RfcMessageNonCompliant and review RFC 5322 specifications for more information. d133si5026040ywb.227 - gsmtp

Received: from filter003.mxroute.com [168.235.111.26] (Authenticated sender: mN4UYu2MZsgR)
by qrelay137.mxroute.com (ZoneMTA) with ESMTPA id 1700922339d000f036.006
for xxxxxxxx@gmail.com;
Mon, 03 Feb 2020 03:40:01 +0000
X-Zone-Loop: d8b20640bab7bfe25ff9c40ada6bb9e8b54ac895c3a7
X-Originating-IP: [168.235.111.26]
Received: from eagle.mxlogin.com (unknown [23.92.74.70])
by filter003.mxroute.com (Postfix) with ESMTPS id 5506F6002D;
Mon, 3 Feb 2020 03:40:00 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=censonph.com; s=default; h=Content-Transfer-Encoding:Content-Type:
MIME-Version:References:Message-ID:To:Date:From:Sender:Reply-To:Subject:Cc:
Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help:
List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=5T79usGxf/z3UtFPbfD18V1Od0JJ6+xsR0rxd4cXaPg=; b=LpLeGrkWovrClTbVITp4leQd2b
xgMXva7Fh0gDnRNs3qlf2qLMUh7G84hgMnwaptzdM3B/6ut17rGn9KiFHLsZKpGR3hikBUa2iR3Fj
SEbL2VG+JJ9T08wgRtrVZUvpFhV5BnznsQ0fj0GddlkgfKIhitlPU3JDiV3psPkOBhurTNMOC6mQy
GEsfP7PiKrDogwF2w5y6YLSLXVbPougrBeKk4j49aLN2AweKC93ofru9NHsnLeq2jZm+Frcoqhb38
+9Co6w68G8a4ssKoFvWDQ2Mqp7b14cUtVNtuwGtAx41EqifeGBAxlBN9/SO5wSdw2fkewkiIF5UaF
Mm+LFbtA==;
Date: Mon, 3 Feb 2020 11:39:59 +0800 (PST)
To: xxxxxxx@gmail.com, hxxxxxxx@gmail.com,
xxxxxxxx@gmail.com, xxxxxxx@gmail.com,
xxxxxxx@gmail.com, xxxxxxx@gmail.com
Message-ID: 243378248.150.1580701199110@server.censonph.com
References: 1278471253.76.1580624292545@server.censonph.com
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-AuthUser: hr@xxxxxxxx.com
X-Spam: Yes

Here is my guess… When an internal message is created and sent, and a email is generated by the system, the header is not being created properly (or to gmails standard).

The fully RFC 822 compliant regex is inefficient and obscure for validate email address because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is RFC 5322. RFC 5322 leads to a regex that can be understood if studied for a few minutes and is efficient enough for actual use.

If you use HTML5, use this code:

<input type="email" name="email" required placeholder="Enter a valid email address">