-
Notifications
You must be signed in to change notification settings - Fork 75
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
Handling special ASCII characters in FromName
#78
Comments
Hey @coel - thanks for the report! Can you paste some example code / strings you're using? From reading I think you're saying you call: mail.FromName("Hello, this is a test!") Is that right? What about the quotes/angle brackets examples?
Lets co-ordinate any fix so you can avoid this happening 😂 🙏 |
Hi @domodwyer, Thanks for looking into this and thanks for you work on this library. Yes, that example is right. Seems like the behaviour from the SMTP server will vary. Trying against my personal Gmail I can see the emails are accepted and
|
Thank you! Looks like something that can definitely be improved! I don't have SES setup, so it'll take me a while to test this and work on a fix (I need a reproducer so I can inspect the headers each way for various inputs). I'll add this to my TODO list, but if you fancy opening a PR I'll happily review that too! Thanks again, Dom |
I discovered if the
FromName
contains a comma the email was being rejected by our SMTP server. Doing more testing, I could see double quotes being stripped out and angle brackets also causing the email to be rejected.Looking at RFC 5322 it seems like this
display-name
can be aquoted-string
when it contains any of thespecials
.In my case I escaped with a backslash any existing backslashes and double quotes, then wrapped the whole string in double quotes. It would be nice if the library handled this (though it would mean my code will cause extra characters to be sent 😅).
The text was updated successfully, but these errors were encountered: