-
-
Notifications
You must be signed in to change notification settings - Fork 861
Add IDN (non-ASCII domain names) support #63
Comments
Ignore this one. Utf-8 is not valid but people seem to be trying to use this :) Original creation date: 2009-05-22T12:23:00Z |
It should be possible to have UTF-8 characters in the e-mail. Domains with UTF-8 like ość.pl exist and swift can't mail to them! Original creation date: 2009-12-17T15:12:42Z |
UTF-8 domains violate RFC 2822, but since they now exist we should certainly slacken to regular expression which checks for the domain portion of the email. e: chris@w3style.co.uk Il giorno 18/dic/2009, alle ore 02.12, Lighthouse ha scritto: Original creation date: 2009-12-17T23:14:03Z |
Do you have a patch for this? Original creation date: 2009-12-18T08:11:46Z |
At the moment there is no "true" UTF-8 in domains - IDNs [ http://en.wikipedia.org/wiki/Internationalized_domain_name ] are still ASCII only, but with UTF-8 characters encoded in Punycode [ http://en.wikipedia.org/wiki/Punycode ]. I will submit my UTF-8->Punycode converter once I find it (give me a couple of hours) and I'll leave it up to you when you want to use it (pre-validation, or post-validation - the lated needing changing the regexp to accommodate for UTF-8 in domain name). I am not entirely sure whenever I made one that does Punycode->UTF-8 as I wrote mine to take care of no IDN support in PHPMailer. Original creation date: 2009-12-21T06:49:57Z |
Update: will add code before the end of the month - I have found it, it works, but also it's totally unreadable, commentless and with variable names such as $_abc2 - It has been a quick and dirty fix and once I make it readable I'll post it here. Original creation date: 2009-12-23T04:24:17Z |
As promised I include my cleaned up converter function. Function accepts prevalidated UTF-8 domain names (not emails!) - extra explode will be required. There shouldn't be much of a performance impact if this function is called for each email - for ASCII only domain names it doesn't do much. Original creation date: 2010-01-02T18:36:05Z |
Correct file attached Original creation date: 2010-01-02T18:38:32Z |
Thanks! I'll try it. But shouldn't this function be built into the Swift library? Original creation date: 2010-01-04T07:50:02Z |
Yes, I think it should. Original creation date: 2010-01-04T08:36:35Z |
Oh, and since I haven't added any licence info in the file: feel free to include any part of my code in swift mailer Original creation date: 2010-01-19T21:15:14Z |
We'll check if we can rely on the http://www.php.net/manual/en/function.idn-to-ascii.php function too :) I'll check how to integrate this in the Address Headers Original creation date: 2011-03-12T22:54:04Z |
idn_to_ascii is nice, but is PHP >= 5.3.0 only and requires 2 PECL packages to be installed installed: PECL intl >= 1.0.2 and PECL idn >= 0.1. Original creation date: 2011-03-13T10:31:11Z |
Hi, I just added your code in my branch, however, for now, it encodes every domain, without the STD3-ASCII Rules, i'll check if it's possible to add this validation, but for this, i need to understand what's the problem exactly. Can you confirm we have permission to embed it as GPL inside Swift? Original creation date: 2011-03-22T21:33:39Z |
I think all domain names will have to pass through this: As for adding it to Swift feel free to include it - I am fine with GPL/LGPL/MIT/BSD or any compatible licence(s). Original creation date: 2011-03-23T00:50:26Z |
OK, thanks for the permission. The validation problem is that domains such as héllo..wòrld are encoded altough it's not a valid domain.
Original creation date: 2011-03-23T00:55:56Z |
I think we shouldn't look to deeply into domain being valid or not - rules vary a lot between TLDs and the resulting regexp would be enormous. Original creation date: 2011-03-23T02:31:18Z |
Please adjust the milestone setting of this bug. It's assigned to 4.1, but meanwhile 4.1.1 is out already :-) Original creation date: 2011-07-25T16:43:49Z |
Until Swift Mailer supports IDN natively, you can use Original creation date: 2011-07-27T21:48:44Z |
Or you can use idn->punycode converter code I have attached few posts earlier - instead of class a single 115 line function. Original creation date: 2011-08-09T19:09:25Z |
any news on this? |
status update, please |
@fabpot: let's finally fix this and #541. I propose we don't add the intl dependency and use true/php-punycode instead for IDN/punycode conversion. The way I see it, the quickest solution would be to generally convert all email addresses containing multibyte chars to punycode (before validation). Comments? Edit: Another option could be to replace validation with voku/email-check and only convert for sending. |
I've just published plugin for Swiftmailer which converts domain name to punycode before sending https://github.com/ossinkine/swiftmailer-punycode-plugin. Maybe someone will find it useful while we have no official support. |
This PR was squashed before being merged into the 6.0-dev branch (closes #1044). Discussion ---------- Basic IDN support | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Doc update? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | #63, #541 | License | MIT IDN domains have been around for more than a decade and are now widely used. Swiftmailer should support internationalised email addresses. Even if you don't use an IDN domain yourself, you may need to send email to people who do. Calling `setTo()` with a non-ASCII email address does not throw an error (it does throw, if the email address is otherwise malformed). The [egulias/EmailValidator](https://github.com/egulias/EmailValidator) package accepts addresses containing non-ASCII characters both in the local-part (the part of the address left of @) and domain (after @). However, when you try to send the email, the SMTP server rejects the address for being syntactically invalid. Handling non-ASCII characters in local-part and domain are two different issues. Non-ASCII characters in the domain is supported by all email servers, as long as the domain is IDN-encoded by the sender. Non-ASCII characters in local-part requires support for the `SMTPUTF8` SMTP extension (see [RFC 6531](https://tools.ietf.org/html/rfc6531)). This PR adds basic support for email addresses using IDN domains. It does not add support for `SMTPUTF8` but simply IDN-encodes the domain, so mail can use the existing infrastructure. The implementation is backwards-compatible fashion. Future work should add support for `SMTPUTF8` in order to support for email addresses with non-ASCII characters in local-part also. This would probably require BC-breaking changes, so it needs to go into a new major release of Swiftmailer. Commits ------- 6a87efd Basic IDN support
Fixed in #1044. Will be included in the upcoming release 6.1.0. This ticket should be closed. |
This took only 6 years |
@MickL Indeed, you could have contributed that feature 6 years ago, but you did not. Big thanks to @c960657 who took the time to investigate the issue, worked on the implementation, tested it, submitted a pull request, worked on making it better based on feedback. Thank you @c960657 in the name of all developers out there who will be able to benefit from this important feature for free. Of course, they don't care how and by whom it was implemented. Some won't even realized that you worked on this for free, without being paid, without any incentives. You deserve one more thank you from me, the maintainer who was too lazy to dedicate a few free days to work on this to please developers who are never satisfied with what they get for free. |
When i use special characters in e-mails which is valid these days you get an error:
Address in mailbox given [Tëst@intermeshdev.nl] does not comply with RFC 2822, 3.6.2.
Original creation date: 2009-05-22T11:56:20Z
Original reporter: Maciej Lisiewski
Original ticket: http://swiftmailer.lighthouseapp.com/projects/21527/tickets/93
The text was updated successfully, but these errors were encountered: