-
Notifications
You must be signed in to change notification settings - Fork 266
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
Error with character outside ASCII range in email address #342
Comments
I'm also seeing this via Swoosh, but then again RFC822 designates that email-addresses must be ascii, so maybe the problem is that Lines 992 to 1011 in 685fc92
|
Here are steps to reproduce in Elixir: Mix.install [:swoosh, :gen_smtp, :hackney]
mail = %Swoosh.Email{to: [{"", "hello@example.com"}], from: [{"", "[email protected]"}], text_body: "test"}
Swoosh.Adapters.AmazonSES.deliver(mail)
|
RFC822 is quite specific that the address must be using ASCII characters. Special characters (for example quotes) in that range will be escaped. I see in the code that non-ASCII name parts are accepted and encoded as UTF-8. The code does assume that the local-name is ASCII though. RFC6531 does allow for unicode local-parts and domain names. A quick reading of the RFC does give me the feeling that for SMTPUTF8 support more needs to be added than just some local-part encoding. UPDATE I see in the code that we do have SMTPUTF8 support for the server side. From the tests: ?assertMatch("250 SMTPUTF8" ++ _, Packet34),
smtp_socket:send(
CSock, <<"MAIL FROM: <испытание@пример.испытание> SMTPUTF8\r\n"/utf8>>
), So maybe it is less work than I first expected. |
Just stumbling upon this too. Would love to see this fixed 🤞 A quick-and-dirty workaround in my case is to disallow non-ASCII emails, by checking if an email consists of ASCII-only characters: List.ascii_printable?(String.to_list(email)) This is OK for my case, since I am working on email validation, to give users early feedback on emails that are likely a result of a copy-paste like this: |
I'm seeing errors when trying to send emails to users with non-ASCII characters in their email address. For instance the Unicode character ้.
The error is showing up here
gen_smtp/src/smtp_util.erl
Line 187 in da7893d
1st argument: not an iodata term
.(We are calling via the Elixir Swoosh library).
The text was updated successfully, but these errors were encountered: