1

After I connect to one of gmail's SMTP servers (via windows cmd), when I try

sending mail to myself, it keeps giving me the same error.

220 mx.google.com ESMTP u3si16129057wmg.22 - gsmtp
ehlo b
250-mx.google.com at your service, [2607:fcd8:a:5:426d:e920:51f3:f36e]
250-SIZE 157286400
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
MAIL FROM: <[email protected]>
250 2.1.0 OK u3si16129057wmg.22 - gsmtp
RCPT TO: <[email protected]>
250 2.1.5 OK u3si16129057wmg.22 - gsmtp
DATA
354  Go ahead u3si16129057wmg.22 - gsmtp
SOMETHING SOMETHING SOMETHING.

.
550-5.7.1 [2607:fcd8:a:5:426d:e920:51f3:f36e      11] Our system has detected
550-5.7.1 that this message is not RFC 5322 compliant. To reduce the amount of
550-5.7.1 spam sent to Gmail, this message has been blocked. Please review
550 5.7.1  RFC 5322 specifications for more information. u3si16129057wmg.22 - gs
mtp


Connection to host lost.

Press any key to continue...

I looked up RFC 5322 and tried the following

220 mx.google.com ESMTP bo10si34007895wjb.163 - gsmtp
ehlo b
250-mx.google.com at your service, [2607:fcd8:a:5:426d:e920:51f3:f36e]
250-SIZE 157286400
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
MAIL FROM: <[email protected]> CRLF
250 2.1.0 OK bo10si34007895wjb.163 - gsmtp
RCPT TO: <[email protected]> CRLF
250 2.1.5 OK bo10si34007895wjb.163 - gsmtp
DATA CRLF
354  Go ahead bo10si34007895wjb.163 - gsmtp
something something something. CRLF
. crlf
. CRLF
.
550-5.7.1 [2607:fcd8:a:5:426d:e920:51f3:f36e      11] Our system has detected
550-5.7.1 that this message is not RFC 5322 compliant. To reduce the amount of
550-5.7.1 spam sent to Gmail, this message has been blocked. Please review
550 5.7.1  RFC 5322 specifications for more information. bo10si34007895wjb.163 -
 gsmtp


Connection to host lost.

Any help is appreciated!

2
  • 1
    What exactly is the question/issue you are trying to address?
    – Castaglia
    Apr 5, 2016 at 2:18
  • How do I write an RFC 5322 compliant email through telnet?
    – Ben Marconi
    Apr 5, 2016 at 5:32

2 Answers 2

4

I can only guess at the OP's reason, but as a sysadmin in a hosting company I use it all the time to debug mail problems. The procedure is simple and described many places, for example https://dougrathbone.com/blog/2010/02/17/manually-testing-smtp-mail-issues-via-telnet.

The problem is that Google is interpreting RFC 5322 somewhat liberally, to require an additional "From:" field after data, such as:

$ telnet gmail-smtp-in.l.google.com. 25
Trying 173.194.222.27...
Connected to gmail-smtp-in.l.google.com (173.194.222.27).
Escape character is '^]'.
220 mx.google.com ESMTP j6si1491418lja.259 - gsmtp
HELO yourhost.com
250 mx.google.com at your service
mail from: <[email protected]>
250 2.1.0 OK j6si1491418lja.259 - gsmtp
rcpt to: <[email protected]>
250 2.1.5 OK j6si1491418lja.259 - gsmtp
data
354  Go ahead j6si1491418lja.259 - gsmtp
From: [email protected]
Subject: test, please ignore
test, please ignore
.
250 2.0.0 OK  1571305610 j6si1491418lja.259 - gsmtp
quit
221 2.0.0 closing connection j6si1491418lja.259 - gsmtp
Connection closed by foreign host.
1

After the DATA command a properly formatted email message is expected/required.

RFC 5322 defines the standard that defines how a "properly formatted message" should look.

A message consists of header fields (collectively called "the header section of the message") followed, optionally, by a body. The header section is a sequence of lines of characters with special syntax as defined in this specification.
The body is simply a sequence of characters that follows the header section and is separated from the header section by an empty line (i.e., a line with nothing preceding the CRLF).

As a quick and easy shortcut to get such a message: most email clients allow you to view the raw/original message format of an existing email. Copy and paste that.

You must log in to answer this question.

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