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

Invalid sender responses #12

Closed
nexces opened this issue Dec 11, 2014 · 7 comments
Closed

Invalid sender responses #12

nexces opened this issue Dec 11, 2014 · 7 comments
Labels

Comments

@nexces
Copy link

nexces commented Dec 11, 2014

It seems that MailHog accepts only single form of sender in MAIL FROM command, which is:

MAIL FROM:<[email protected]>

putting space after colon or omitting angle brackets like

MAIL FROM: <[email protected]>

MAIL FROM:[email protected]

MAIL FROM: [email protected]

leads to "550 Invalid sender" however most MTAs accepts those as valid forms.

@ian-kent
Copy link
Member

Thanks @nexces

RFC5321 (section 3.3) is explicit on the permitted syntax for MAIL and RCPT commands:

The first or only argument to this command includes a forward-path
(normally a mailbox and domain, always surrounded by "<" and ">"
brackets) identifying one recipient.

and

Since it has been a common source of errors, it is worth noting that
spaces are not permitted on either side of the colon following FROM
in the MAIL command or TO in the RCPT command.  The syntax is exactly
as given above.

Worth mentioning that RFC821 also doesn't permit any other RCPT/MAIL command syntax, but it isn't as explicitly documented.

Do you have examples of MTAs which support the broken syntax?

And what SMTP client are you using? It would be better for those libraries fix their SMTP support, rather than altering MailHog to support invalid syntax (the broken syntax, for example, isn't supported by Google Mail in any way).

Having said that, it would be possible to add a feature flag to enable less strict parsing of some commands, I'm just not really sure that's the most appropriate solution.

@nexces
Copy link
Author

nexces commented Dec 11, 2014

For this moment I can only confirm that Postfix accepts all mentioned formats and M$ Exchange accepts at least

MAIL FROM: [email protected]

I might be able to test more MTA in few days.
I'm using SwiftMailer as SMTP client.

@ian-kent
Copy link
Member

This appears to be a broken implementation for SwiftMailer - I've just opened an issue: swiftmailer/swiftmailer#573

It can be fixed in MailHog (fairly easy, its just a regex change), but would prefer not to unless the "fix" was added as a feature flag.

@nexces
Copy link
Author

nexces commented Dec 15, 2014

I've got curious by your statement that Google Mail does not accept broken syntax so I've tested it using SwiftMailer.
SwiftMailer had no problem sending email using my account.
Here's SwiftMailer partial log (addresses changed):

>> MAIL FROM: <[email protected]>

<< 250 2.1.0 OK e7sm12106181wjx.31 - gsmtp

>> RCPT TO: <[email protected]>

<< 250 2.1.5 OK e7sm12106181wjx.31 - gsmtp

@ian-kent
Copy link
Member

You're right - thought I'd tested it at the time, looks like I was wrong!

Not entirely happy about intentionally breaking SMTP spec, but who am I to argue with Google? 😄

I'll update the regex to support the broken syntax!

@nexces
Copy link
Author

nexces commented Dec 20, 2014

"You're the man!" to argue with Google. ;)
I'm totally ok with extra flag and I think that it should be done this way. Google probably accepts broken syntax because most of the world uses it - maybe because it's easier to read to human if there is extra space after colon.

@ian-kent ian-kent added this to the Go-MailHog v0.08 milestone Dec 20, 2014
@ian-kent ian-kent added the bug label Dec 20, 2014
@patie
Copy link

patie commented Jun 12, 2015

its fixed ? for me MailHog dont work with swiftmailer 5.4.1 i dont know why... "Exception occurred while flushing email queue: Connection could not be established with host....." any idea please ?

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

3 participants