ESP32 SMTP connection fails over onboard Ethernet only - smtp

I have an Olimex ESP32-EVB board with builtin LAN8720 ethernet.
I would like to send email over Ethernet but it fails when Identification (not authentication) comes. The TCP connection suddenly closed by the board.
With WiFi it works perfectly, but i dont want to use WiFi.
All credentials are ok.
Tried with multiple SMTP server.
Tried with DHCP, fix IP.
DNS set manually. Hostname set manually. Using port 587.
Arduino IDE 1.8.12, ESP32 core version 1.0.4.
Email library: mobizt/ESP32-MAil-Client
Debug messages:
15:18:49.915 -> Connecting to SMTP server...
15:18:49.915 -> [DEBUG] - INFO: connecting to SMTP server...
15:18:49.915 -> [DEBUG] - smtp.gmail.com
15:18:49.915 -> [DEBUG] - 587
15:18:49.915 -> [DEBUG] - INFO: cleaning SSL connection
15:18:49.915 -> [DEBUG] - INFO: starting socket
15:18:49.977 -> [DEBUG] - INFO: connecting to Server...
15:18:50.024 -> [DEBUG] - INFO: server connected
15:18:50.024 -> [DEBUG] - INFO: begin STARTTLS handshake
15:18:51.019 -> [DEBUG] - 220 smtp.gmail.com ESMTP z22sm16371993wmi.1 - gsmtp
15:18:51.019 ->
15:18:51.019 -> ⸮!Pk
15:18:51.019 -> [DEBUG] - INFO: send SMTP command extended HELO
15:18:52.013 -> [DEBUG] - 250-smtp.gmail.com at your service, [5.63.214.69]
15:18:52.013 -> 250-SIZE 35882577
15:18:52.091 -> 250-8BITMIME
15:18:52.091 -> 250-STARTTLS
15:18:52.091 -> 250-ENHANCEDSTATUSCODES
15:18:52.091 -> 250-PIPELINING
15:18:52.091 -> 250-CHUNKING
15:18:52.091 -> 250 SMTPUTF8
15:18:52.091 ->
15:18:52.091 -> [DEBUG] - INFO: send STARTTLS protocol command
15:18:53.062 -> [DEBUG] - 220 2.0.0 Ready to start TLS
15:18:53.062 ->
15:18:53.062 -> [DEBUG] - INFO: seeding the random number generator
15:18:53.062 -> [DEBUG] - INFO: setting up the SSL/TLS structure...
15:18:53.062 -> [DEBUG] - INFO: setting hostname for TLS session...
15:18:53.062 -> [DEBUG] - INFO: performing the SSL/TLS handshake...
15:18:54.002 -> [DEBUG] - INFO: verifying peer X.509 certificate...
15:18:54.002 -> [DEBUG] - INFO: certificate verified
15:18:54.002 -> [DEBUG] - INFO: smtp server connected
15:18:54.002 -> Identification...
15:18:54.002 -> [DEBUG] - INFO: send smtp HELO command
15:18:54.002 -> Error, identification failed //<- WiFi can pass through here
15:18:54.002 -> [DEBUG] - ERROR: identification failed
15:18:54.002 -> [DEBUG] - INFO: cleaning SSL connection
15:18:54.002 -> Error sending Email, identification failed
Wireshark:
3033 1591.392626 192.168.137.2 108.177.15.108 TCP 58 52839 → 587 [SYN] Seq=0 Win=5744 Len=0 MSS=1436
3034 1591.451031 108.177.15.108 192.168.137.2 TCP 58 587 → 52839 [SYN, ACK] Seq=0 Ack=1 Win=62920 Len=0 MSS=1430
3035 1591.451720 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=1 Ack=1 Win=22976 Len=0
3036 1591.510841 108.177.15.108 192.168.137.2 SMTP 107 S: 220 smtp.gmail.com ESMTP n1sm40021609wrj.77 - gsmtp
3037 1591.510913 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=1 Ack=54 Win=22976 Len=0
3038 1591.920478 192.168.137.1 224.0.0.251 MDNS 102 Standard query response 0x0000 A, cache flush 192.168.137.1
3039 1592.452915 192.168.137.2 108.177.15.108 SMTP 65 C: EHLO DUDE
3040 1592.540947 108.177.15.108 192.168.137.2 TCP 54 587 → 52839 [ACK] Seq=54 Ack=12 Win=62920 Len=0
3041 1592.548404 108.177.15.108 192.168.137.2 SMTP 221 S: 250-smtp.gmail.com at your service, [5.63.214.69] | SIZE 35882577 | 8BITMIME | STARTTLS | ENHANCEDSTATUSCODES | PIPELINING | CHUNKING | SMTPUTF8
3042 1592.548522 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=12 Ack=221 Win=22976 Len=0
3043 1593.462134 192.168.137.2 108.177.15.108 SMTP 64 C: STARTTLS
3044 1593.520641 108.177.15.108 192.168.137.2 SMTP 84 S: 220 2.0.0 Ready to start TLS
3045 1593.520684 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=22 Ack=251 Win=22976 Len=0
3046 1594.475617 192.168.137.2 108.177.15.108 TLSv1 357 Client Hello
3047 1594.551024 108.177.15.108 192.168.137.2 SSL 152 [TCP Previous segment not captured] , Continuation Data
3048 1594.551408 108.177.15.108 192.168.137.2 TCP 1484 [TCP Out-Of-Order] 587 → 52839 [ACK] Seq=251 Ack=325 Win=63784 Len=1430
3049 1594.553589 192.168.137.2 108.177.15.108 TCP 54 [TCP Dup ACK 3045#1] 52839 → 587 [ACK] Seq=325 Ack=251 Win=22976 Len=0
3050 1594.553722 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=325 Ack=1681 Win=22976 Len=0
3051 1594.558306 108.177.15.108 192.168.137.2 TCP 1484 [TCP Out-Of-Order] 587 → 52839 [ACK] Seq=1681 Ack=325 Win=63784 Len=1430
3052 1594.558355 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=325 Ack=3209 Win=22976 Len=0
3053 1594.925986 192.168.137.1 224.0.0.251 MDNS 93 Standard query response 0x0000 A, cache flush 192.168.8.101
3054 1595.313210 192.168.137.2 108.177.15.108 TLSv1.2 129 Client Key Exchange
3055 1595.317151 192.168.137.2 108.177.15.108 TLSv1.2 60 Change Cipher Spec
3056 1595.318389 192.168.137.2 108.177.15.108 TLSv1.2 99 Encrypted Handshake Message
3057 1595.380724 108.177.15.108 192.168.137.2 TCP 54 587 → 52839 [ACK] Seq=3209 Ack=406 Win=63784 Len=0
3058 1595.388265 108.177.15.108 192.168.137.2 TLSv1.2 346 New Session Ticket, Change Cipher Spec, Encrypted Handshake Message
3059 1595.401198 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=451 Ack=3501 Win=22976 Len=0
3060 1595.416261 192.168.137.2 108.177.15.108 TLSv1.2 92 Application Data
3061 1595.416793 192.168.137.2 108.177.15.108 TLSv1.2 85 Application Data
3062 1595.422297 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [FIN, ACK] Seq=520 Ack=3501 Win=22976 Len=0
3063 1595.470711 108.177.15.108 192.168.137.2 TCP 54 587 → 52839 [ACK] Seq=3501 Ack=520 Win=63784 Len=0
3064 1595.478523 108.177.15.108 192.168.137.2 TLSv1.2 119 Application Data
3065 1595.478549 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [ACK] Seq=521 Ack=3566 Win=22976 Len=0
3066 1595.479195 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [RST, ACK] Seq=521 Ack=3566 Win=5744 Len=0
3067 1595.490816 108.177.15.108 192.168.137.2 TCP 54 587 → 52839 [FIN, ACK] Seq=3566 Ack=521 Win=63784 Len=0
3068 1595.492336 192.168.137.2 108.177.15.108 TCP 54 52839 → 587 [RST] Seq=521 Win=0 Len=0
Any suggestion where to start? (Espressif forum - no answer, ESP32 github issue - no answer)

Related

Chrome forces http1.1 instead of h2 after 401 needed for spnego

I configured nginx + spnego module to login users via sso at specific address and noticed that as soon as that happens chrome forces http/1.1 for entire subdomain. Without SSO whole site is working with http/2. Nginx is (1.15.0), spnego module from github and current chrome (v71).
I turned on debug information in nginx and there is:
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN supported by client: h2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN supported by client: http/1.1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN selected: h2
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN supported by client: h2
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN supported by client: http/1.1
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN selected: h2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_do_handshake: -1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_get_error: 2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 reusable connection: 0
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL handshake handler: 0
2019/01/07 14:39:11 [debug] 42129#42129: *2378 ssl new session: 057AF550:32:184
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_do_handshake: 1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL: TLSv1.2, cipher: "ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD"
2019/01/07 14:39:11 [debug] 42129#42129: *2378 init http2 connection
At this stage it's ok - it's http2, but modules sends 401 code and ask for credentials:
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 header filter
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 push resources
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: ":status: 401"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "server: nginx"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "date: Mon, 07 Jan 2019 13:41:05 GMT"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "content-type: text/html; charset=utf-8"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "content-length: 590"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "www-authenticate: Negotiate"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "strict-transport-security: max-age=63072000; includeSubDomains; preload"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2:5 create HEADERS frame 000055B593338C60: len:133 fin:0
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http cleanup add: 000055B593338D58
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 frame out: 000055B593338C60 sid:5 bl:1 len:133
To this point h2 seems to work fine, after that chrome sends only http 1.1 alpn in response to 401 page:
2019/01/07 14:41:05 [debug] 42129#42129: *2378 reusable connection: 1
2019/01/07 14:41:05 [debug] 42129#42129: *2378 event timer del: 53: 8023593525
2019/01/07 14:41:05 [debug] 42129#42129: *2378 event timer add: 53: 180000:8023706453
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL ALPN supported by client: http/1.1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL ALPN selected: http/1.1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_do_handshake: -1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_get_error: 2
2019/01/07 14:41:05 [debug] 42129#42129: *4179 reusable connection: 0
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL handshake handler: 0
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_do_handshake: 1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL: TLSv1.2, cipher: "ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD"
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL reused session
2019/01/07 14:41:05 [debug] 42129#42129: *4179 reusable connection: 1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 http wait request handler
After that everything will be in http/1 for whole domain. I configured wildcard server in nginx and tested that many times - until auth h2, and after auth http1. For now I will move auth endpoint to another subdomain so chrome will not force http1 for application but I'm still looking to fix.
I checked ssl, cert, ciphers - that doesn't change on http/1 and http/2, and it's not any antivirus software.
Also I'm unable to clear that state and FORCE http/2 after login, the only thing that helps is to kill chrome process. Clearing app cache doesn't help.
It works in IE and EDGE. Firefox by default don't support SSO and policies.
How can I force Chrome to use http/2 for domain? If it's not possible to do that on auth page, how can I force that to other pages except one url?
Anyone know how can I force chrome to renegotiate http/2 in dev tools.
Also I could not find any logs and error in chrome about switch from http/2 to v1
This is a known bug in Chrome. It is a knock on effect of the fact that Chrome doesn't support SSO over HTTP/2 but also does not support some HTTP/1 and some HTTP/2 connections to the same domain.
See bug here https://bugs.chromium.org/p/chromium/issues/detail?id=832586
And particularly the comment at the bottom:
The root of the problem here is that the network stack currently does
not support concurrent HTTP/1.1 and HTTP/2 connections to the same
server. See issue 685741 comments 10 and 11 about opinions on this
possibility.

How to setup postfix on gcloud?

I trying to setup a multiple domain server in gcloud instance, following this tutorial https://vorkbaard.nl/installing-a-mailserver-on-debian-8-part-3-mta-postfix/ , I modify /etc/postfix/master.cf :
smtp inet n - y - - smtpd
to
597 inet n - y - - smtpd
when I telnet domain 597 I get succefully a connection, but trying to send an email from mailx or from the telnet client I get an error as if postfix still use 25 port:
Aug 24 19:26:08 localhost postfix/smtp[1404]: connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:400c:c0f::1b]:25: Network is unreachable
So where I need to change the port to use to postfix work in google computer instance ? Telnet outside google network works ok!
thanks!
[edit]
After more debugs and test sending email to the same email send and recibe, from round cube, and from thunderbird, so I think the problem its the outside traffic from the port 25 and I dont know why postfix use 25 port if the master.cf stmp port is set to 597
mail.log debug sending from roundcube
Aug 25 00:58:59 localhost dovecot: imap(sender#domain.com): Debug: maildir++: root=/var/mail/vmail/inova.cloud/info, index=, indexpvt=, control=, inbox=/var/mail/vmail/inova.cloud/info, alt=
Aug 25 00:58:59 localhost dovecot: imap(sender#domain.com): Logged out in=50 out=511
Aug 25 00:59:22 localhost postfix/qmgr[952]: 494C582008: from=<sender#domain.com>, size=524, nrcpt=1 (queue active)
Aug 25 00:59:22 localhost postfix/qmgr[952]: 4F95180D0A: from=<nano#server.c.majestic-lodge-173213.internal>, size=461, nrcpt=1 (queue active)
Aug 25 00:59:22 localhost postfix/error[1435]: 494C582008: to=<destination#domain>, relay=none, delay=4617, delays=4617/0.06/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect t$
Aug 25 00:59:22 localhost postfix/error[1436]: 4F95180D0A: to=<destination#domain>, relay=none, delay=80226, delays=80226/0.03/0/0.01, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect$
Aug 25 00:59:59 localhost dovecot: imap-login: Debug: SSL: elliptic curve secp384r1 will be used for ECDH and ECDHE key exchanges
Aug 25 00:59:59 localhost dovecot: imap-login: Debug: SSL: elliptic curve secp384r1 will be used for ECDH and ECDHE key exchanges
Aug 25 00:59:59 localhost dovecot: auth: Debug: auth client connected (pid=1442)
Aug 25 00:59:59 localhost dovecot: auth: Debug: client in: AUTH#0111#011PLAIN#011service=imap#011secured#011session=0wbZdolXxJkAAAAAAAAAAAAAAAAAAAAB#011lip=::1#011rip=::1#011lport=143#011rport=39364#011resp=AGl$
Aug 25 00:59:59 localhost dovecot: auth-worker(1430): Debug: sql(sender#domain.com,::1,<0wbZdolXxJkAAAAAAAAAAAAAAAAAAAAB>): query: SELECT email as username, pwd AS password FROM addresses WHERE email = 'info#$
Aug 25 00:59:59 localhost dovecot: auth: Debug: client passdb out: OK#0111#011user=sender#domain.com
Aug 25 00:59:59 localhost dovecot: auth: Debug: master in: REQUEST#0112225078273#0111442#0111#0117898818d71c58f150c8d4f75bb936fb5#011session_pid=1443#011request_auth_token
Aug 25 00:59:59 localhost dovecot: auth-worker(1430): Debug: sql(sender#domain.com,::1,<0wbZdolXxJkAAAAAAAAAAAAAAAAAAAAB>): SELECT 5000 AS uid, 5000 as gid, email, '/var/mail/vmail/domain/info' AS home FROM$
Aug 25 00:59:59 localhost dovecot: auth: Debug: master userdb out: USER#0112225078273#011sender#domain.com#011uid=5000#011gid=5000#011email=sender#domain.com#011home=/var/mail/vmail/domain/info#011auth_token$
Aug 25 00:59:59 localhost dovecot: imap-login: Login: user=<sender#domain.com>, method=PLAIN, rip=::1, lip=::1, mpid=1443, secured, session=<0wbZdolXxJkAAAAAAAAAAAAAAAAAAAAB>
Aug 25 00:59:59 localhost dovecot: imap(sender#domain.com): Debug: Added userdb setting: plugin/email=sender#domain.com
Aug 25 00:59:59 localhost dovecot: imap(sender#domain.com): Debug: Effective uid=5000, gid=5000, home=/var/mail/vmail/inova.cloud/info
Aug 25 00:59:59 localhost dovecot: imap(sender#domain.com): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/vmail/domain/info
Aug 25 00:59:59 localhost dovecot: imap(sender#domain.com): Debug: maildir++: root=/var/mail/vmail/domain/info, index=, indexpvt=, control=, inbox=/var/mail/vmail/domain/info, alt=
Aug 25 00:59:59 localhost dovecot: imap(sender#domain.com): Logged out in=50 out=511
From outside email it doesnt recive
Two important facts:
GCE blocks outbound email on port 25, 465 and 587 (except for port 465 or 587 to Google Apps relay only).
If you are not using a relay, you cannot choose the oubound port. This is because you must connect to whichever port your destination is listening to, which will be a standard (blocked) port.
As a result you must use a email relay, which you are not by the sound of it. At the bottom of the page I linked above are some options for email relays you can use. They all include postfix options.

Tshark - Two types of OpenFlow FLOW_MOD packets

I am running an SDN controller on port #6633 and then capturing the packets going to it using tshark which is give me following output:
*18 0.029550379 127.0.0.1 ?~F~R 127.0.0.1 OpenFlow 138 Type: OFPT_FLOW_MOD*
19 0.031562043 127.0.0.1 ?~F~R 127.0.0.1 TCP 88 8984?~F~R56292 [PSH, ACK] Seq=1 Ack=86 Win=86 Len=22 TSval=7474079 TSecr=7474075
20 0.031591119 127.0.0.1 ?~F~R 127.0.0.1 TCP 66 56292?~F~R8984 [ACK] Seq=86 Ack=23 Win=86 Len=0 TSval=7474079 TSecr=7474079
21 0.031786109 127.0.0.1 ?~F~R 127.0.0.1 TCP 163 56292?~F~R8984 [PSH, ACK] Seq=86 Ack=23 Win=86 Len=97 TSval=7474079 TSecr=7474079
*22 0.031958834 127.0.0.1 ?~F~R 127.0.0.1 OpenFlow 146 Type: OFPT_FLOW_MOD*
23 0.032035439 127.0.0.1 ?~F~R 127.0.0.1 TCP 66 47418?~F~R6633 [ACK] Seq=341 Ack=169 Win=44032 Len=0 TSval=7474079 TSecr=7474079
24 0.032732179 127.0.0.1 ?~F~R 127.0.0.1 TCP 88 8984?~F~R56292 [PSH, ACK] Seq=23 Ack=183 Win=86 Len=22 TSval=7474080 TSecr=7474079
25 0.038687398 36:68:ff:8e:d1:9c ?~F~R Broadcast OpenFlow 126 Type: OFPT_PACKET_IN
As per my application, there should be only one flow rule installed in switch. When I used the dpctl dump-flows in mininet then it also returned me only one flow rule. Now I have doubt because there are two flow mod packets.
In Packet #18 and 22 both are OFPT_FLOW_MOD packets, but if you see then both packets have a different number after OpenFlow keyword, see the third column. Could anyone explain it to me?
There's a number after every protocol, not just OpenFlow packets. Take a look at the others, for example packet #19 "TCP 88".
In all likelihood, you have a Wireshark Length column following the Protocol column, and this value is just the number of bytes in the packet. Check your Wireshark columns; tshark just uses the same ones by default.

Strange behaviour with new sendmail.cf

I am trying to change my sendmail configuration to deliver all "user unknown" emails to a specific account (baduser).
I added the DL definition to sendmail.mc and generated test.cf.
Then I tested this new config using:
echo who | sendmail -v -Ctest.cf noone
and the email was correctly delivered to the defined account.
I then renamed test.cf to sendmail.cf (in /etc/mail) and retested with:
echo what | sendmail -Csendmail.cf noone
and again the email was delivered to the baduser account.
Happy with this, I then restarted sendmail (via systemctl) and sent yet another email to an invalid account.
Instead of the email being delivered to baduser, I received a 550 5.1.1 user unknown reject email.
What have I missed here.
(Fedora 22 & sendmail 8.14.7/8.13.3)
Here are the log entries for a reject.
Nov 27 09:59:19 server sendmail[46243]: tAQNTJQH046243: from=scldad, size=4, class=0, nrcpts=1, msgid=<201511262329.tAQNTJQH046243#server.benparts.com.au>, relay=scldad#localhost
Nov 27 09:59:19 server sendmail[46243]: tAQNTJQH046243: to=noone, ctladdr=scldad (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30004, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
-v -i log:
No domain:
[scldad#server ~]$ (echo subject: test; echo) | /usr/sbin/sendmail -v -i noone
noone... Connecting to [127.0.0.1] via relay...
220 server.benparts.com.au ESMTP Sendmail 8.14.7/8.13.3; Sat, 28 Nov 2015 13:29:02 +1030
>>> EHLO server.benparts.com.au
250-server.benparts.com.au Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<scldad#server.benparts.com.au> SIZE=15
250 2.1.0 <scldad#server.benparts.com.au>... Sender ok
>>> RCPT To:<noone#server.benparts.com.au>
>>> DATA
550 5.1.1 <noone#server.benparts.com.au>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/home/scldad/dead.letter... Saved message in /home/scldad/dead.letter
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 server.benparts.com.au closing connection
With domain:
[scldad#server ~]$ (echo subject: test; echo) | /usr/sbin/sendmail -v -i noone#benparts.com.au
noone#benparts.com.au... Connecting to [127.0.0.1] via relay...
220 server.benparts.com.au ESMTP Sendmail 8.14.7/8.13.3; Sat, 28 Nov 2015 13:27:38 +1030
>>> EHLO server.benparts.com.au
250-server.benparts.com.au Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<scldad#server.benparts.com.au> SIZE=15
250 2.1.0 <scldad#server.benparts.com.au>... Sender ok
>>> RCPT To:<noone#benparts.com.au>
>>> DATA
550 5.1.1 <noone#benparts.com.au>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/home/scldad/dead.letter... Saved message in /home/scldad/dead.letter
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 server.benparts.com.au closing connection
As root:
[root#server ~]# (echo subject: test; echo) | /usr/sbin/sendmail -v -i noone
noone... Connecting to [127.0.0.1] via relay...
220 server.benparts.com.au ESMTP Sendmail 8.14.7/8.13.3; Sat, 28 Nov 2015 13:30:00 +1030
>>> EHLO server.benparts.com.au
250-server.benparts.com.au Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<scldad#server.benparts.com.au> SIZE=15
250 2.1.0 <scldad#server.benparts.com.au>... Sender ok
>>> RCPT To:<noone#server.benparts.com.au>
>>> DATA
550 5.1.1 <noone#server.benparts.com.au>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
scldad... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1039
250 2.1.0 <>... Sender ok
>>> RCPT To:<scldad#server.benparts.com.au>
>>> DATA
250 2.1.5 <scldad#server.benparts.com.au>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <scldad#server.benparts.com.au>... Connecting to local...
050 <scldad#server.benparts.com.au>... Sent
250 2.0.0 tAS300jh034101 Message accepted for delivery
scldad... Sent (tAS300jh034101 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 server.benparts.com.au closing connection

openssl client SMTP with gmail port 587, no response (250 OK) from after <crlf>.<crlf>

I've been trying to use openssl to establish a connection with smtp.gmail.com port 587 or 465 with:
openssl s_client -host smtp.gmail.com -port 587 -starttls smtp
and the authentication, mail from, rcpt to, and data were all successful. but my problem is, after i write . in a new line, no 250 OK response from the server.
here is the process:
CONNECTED(00000003)
depth=1 /C=US/O=Google Inc/CN=Google Internet Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
i:/C=US/O=Google Inc/CN=Google Internet Authority
1 s:/C=US/O=Google Inc/CN=Google Internet Authority
i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
(certification)
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
issuer=/C=US/O=Google Inc/CN=Google Internet Authority
---
No client certificate CA names sent
---
SSL handshake has read 1910 bytes and written 338 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-MD5
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : RC4-MD5
Session-ID: 28E597C0025A93C82AD4A7C517F699B37D106D760597467B522C1041F1BC17C8
Session-ID-ctx:
Master-Key: 1CC83A8A4B7864DF9BBD9E9742B4E5A5937941EB2A28B88A1D4214920B77AC976D3ADC2DA7B60CF8BD6BC2B0712A42A2
Key-Arg : None
Start Time: 1296911515
Timeout : 300 (sec)
Verify return code: 20 (unable to get local issuer certificate)
---
250 ENHANCEDSTATUSCODES
ehlo
250-mx.google.com at your service, [121.94.150.147]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250 ENHANCEDSTATUSCODES
auth login
334 VXNlcm5hbWU6
<my email>
334 UGFzc3dvcmQ6
<my password>
235 2.7.0 Accepted
mail from:<email>
250 2.1.0 OK t14sm1471936icd.10
rcpt to:<email>
250 2.1.5 OK t14sm1471936icd.10
data
from: someone <email>
354 Go ahead t14sm1471936icd.10
to : someone <email>
subject: test
test
test2
.
451 4.4.2 Timeout - closing connection. t14sm1471936icd.10
read:errno=0
I am using cygwin in win7 32.
I've been searching for all of the possible keywords on google but no solution comes out.
PLEASE HELP!
Maybe add the '-crlf' option to the comand line :
openssl s_client -host smtp.gmail.com -port 587 -starttls smtp -crlf