Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognised command "MAIL FROM:<[address]>" #3

Closed
dpeuscher opened this issue Oct 29, 2014 · 6 comments
Closed

Unrecognised command "MAIL FROM:<[address]>" #3

dpeuscher opened this issue Oct 29, 2014 · 6 comments
Assignees
Labels
Milestone

Comments

@dpeuscher
Copy link

When I try to use MailHog in a Zend Framework 1 Application via SMTP, I get an exception with the message "Unrecognised command". After sone debugging I found the SMTP-command "MAIL FROM:<[e-mail-address]>" responsible for the exception.

@ian-kent
Copy link
Member

If possible, could you paste the MailHog log output for this bug - I can't reproduce it locally.

Tried against MailHog v0.03 and it works (but from telnet, not Zend):

~ ❯❯❯ telnet localhost 1025
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mailhog.example ESMTP Go-MailHog
EHLO localhost
250-Hello localhost
250-PIPELINING
250 AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN
MAIL FROM:<e-mail-address>
250 Sender e-mail-address ok
RCPT TO:<e-mail-address>
250 Recipient e-mail-address ok
DATA
354 End data with <CR><LF>.<CR><LF>
Some data

.
250 Ok: queued as 54510171a54d751d5c000001
QUIT
221 Bye
Connection closed by foreign host.

@ian-kent ian-kent self-assigned this Oct 29, 2014
@ian-kent ian-kent added this to the MailHog v0.04 milestone Oct 29, 2014
@dpeuscher
Copy link
Author

Tail of the log-file:

2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] Starting session
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] Sent 26 bytes: 'flug.c24 ESMTP Go-MailHog
'
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] Received 16 bytes: 'EHLO localhost^M
'
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] Processing line: EHLO localhost
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] In state 0, got command 'EHLO', args 'localhost'
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 0] Got EHLO command, switching to MAIL state
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 3] Sent 16 bytes: 'Hello localhost
'
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 3] Sent 11 bytes: 'PIPELINING
'
2014/10/29 17:04:09 [SMTP 127.0.0.1:60610, 3] Sent 35 bytes: 'AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN
'
2014/10/29 17:04:12 [SMTP 127.0.0.1:60610, 3] Received 6 bytes: 'RSET^M
'
2014/10/29 17:04:12 [SMTP 127.0.0.1:60610, 3] Processing line: RSET
2014/10/29 17:04:12 [SMTP 127.0.0.1:60610, 3] In state 3, got command 'RSET', args ''
2014/10/29 17:04:12 [SMTP 127.0.0.1:60610, 3] Got RSET command, switching to ESTABLISH state
2014/10/29 17:04:12 [SMTP 127.0.0.1:60610, 0] Sent 3 bytes: 'Ok
'
2014/10/29 17:04:13 [SMTP 127.0.0.1:60610, 0] Received 29 bytes: 'MAIL FROM:<[Mail-Address]>^M
'
2014/10/29 17:04:13 [SMTP 127.0.0.1:60610, 0] Processing line: MAIL FROM:<[Mail-Address]>
2014/10/29 17:04:13 [SMTP 127.0.0.1:60610, 0] In state 0, got command 'MAIL', args 'FROM:<[Mail-Address]>'
2014/10/29 17:04:13 [SMTP 127.0.0.1:60610, 0] Got unknown command for ESTABLISH state: 'MAIL'
2014/10/29 17:04:13 [SMTP 127.0.0.1:60610, 0] Sent 21 bytes: 'Unrecognised command
'
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] Received 6 bytes: 'QUIT^M
'
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] Processing line: QUIT
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] In state 0, got command 'QUIT', args ''
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] Got QUIT command
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] Sent 4 bytes: 'Bye
'
2014/10/29 17:04:20 [SMTP 127.0.0.1:60610, 0] Connection closed by remote host

Edit: Don't want the mail to be public available :)

@ian-kent
Copy link
Member

Thanks for the info. Can understand why you edited it, but I think that removed the bug.

The example you now give works in Go-MailHog:

~ ❯❯❯ telnet localhost 1025
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mailhog.example ESMTP Go-MailHog
EHLO localhost
250-Hello localhost
250-PIPELINING
250 AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN
MAIL FROM:<[Mail-Address]>
250 Sender [Mail-Address] ok
QUIT
221 Bye
Connection closed by foreign host.

The example you originally gave didn't, because it wasn't valid SMTP syntax (it was missing the <> around the email address, e.g. MAIL FROM:email@example.com), so I suspect its a bug in the Zend SMTP client, which wouldn't be supported by Google either:

~ ❯❯❯ telnet gmail-smtp-in.l.google.com 25                                                                                                    
Trying 64.233.167.27...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP ez14si7285624wid.57 - gsmtp
EHLO localhost
250-mx.google.com at your service, [***.***.***.***]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
MAIL FROM:email@example.com
555 5.5.2 Syntax error. ez14si7285624wid.57 - gsmtp
QUIT
221 2.0.0 closing connection ez14si7285624wid.57 - gsmtp
Connection closed by foreign host.

Edit I couldn't find an SMTP RFC showing that syntax as valid, but happy for you to reopen the bug if there is one

@ian-kent
Copy link
Member

@dpeuscher
Copy link
Author

Actually there were <> and I was using ZF 1.12.7. I updated to 1.12.9 to be
sure to have the most recent version. This did not fix the issue. Same
result:

2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Starting session
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Sent 26 bytes: 'flug.c24
ESMTP Go-MailHog
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Received 16 bytes: 'EHLO
localhost^M
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Processing line: EHLO
localhost
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] In state 0, got command
'EHLO', args 'localhost'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Got EHLO command, switching
to MAIL state
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Sent 16 bytes: 'Hello
localhost
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Sent 11 bytes: 'PIPELINING
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Sent 35 bytes: 'AUTH
EXTERNAL CRAM-MD5 LOGIN PLAIN
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Received 6 bytes: 'RSET^M
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Processing line: RSET
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] In state 3, got command
'RSET', args ''
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 3] Got RSET command, switching
to ESTABLISH state
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Sent 3 bytes: 'Ok
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Received 29 bytes: 'MAIL
FROM:<[E-Mail-Address]>^M
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Processing line: MAIL
FROM:<[E-Mail-Address]>
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] In state 0, got command
'MAIL', args 'FROM:<[E-Mail-Address]>'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Got unknown command for
ESTABLISH state: 'MAIL'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Sent 21 bytes: 'Unrecognised
command
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Received 6 bytes: 'QUIT^M
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Processing line: QUIT
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] In state 0, got command
'QUIT', args ''
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Got QUIT command
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Sent 4 bytes: 'Bye
'
2014/10/29 17:44:09 [SMTP 127.0.0.1:60897, 0] Connection closed by remote
host

2014-10-29 18:21 GMT+01:00 Ian Kent notifications@github.com:

If its using the latest Zend Framework 1 or 2, it shouldn't be happening:

https://github.com/zendframework/zf2/blob/master/library/Zend/Mail/Protocol/Smtp.php#L239

https://github.com/zendframework/zf1/blob/master/library/Zend/Mail/Protocol/Smtp.php#L260


Reply to this email directly or view it on GitHub
#3 (comment).

@ian-kent ian-kent reopened this Oct 29, 2014
@ian-kent
Copy link
Member

Thanks for the update - just spotted it, RSET is putting Go-MailHog back in ESTABLISH state, which is expecting another HELO/EHLO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants