#110 new
Akky AKIMOTO

Japanese cellphone address needs to bypass RFC validation

Reported by Akky AKIMOTO | October 7th, 2009 @ 07:06 PM

By historical silly misunderstandings, some of Japanese cellphone carriers (NTT Docomo and KDDI au, No.1 and No.2 market shareholders) introduced RFC violated mail addresses. Even they fixed it for new registration, they are still widely used.

1) Local part begins with period

.foo@example.com

2) Local part ends with period

bar.@example.com

3) conseqtive periods in local part

ba...z@example.com

All of above do not follow RFC2821, so giving those mail to Swift Mailer throws Exception.

MTA

But are they transferred properly? It depends on MTA. On Japanese part of the internet, they are usually accepted and transferred, because hundred of thousand such users exist.

How other mailers treat it

iPhone

When you tries to send to those address on iPhone, it pops up warning dialog. But you can proceed to send them.

Outlook

Outlook make it strict from Service Pack 3 and now you cannot send to those mail addresses.

Gmail

Google once introduced strict RFC filter, but now supports those format addresses if the receipients' domains are NTT Docomo or KDDI au.

Possible Fixes

I think it is a business and marketing decision so just list up fix options and want core team to choose.

1) change filter and always accept them

As your products and services can be used by Japanese with their cellphone address, it is one option to make them accepted by all Swift Mailer users.

Pro: - all Swift Mailer user applications are Japanese market compliant Con: - everyone should make effort to follow the standard way - invalid mail may cause with others if the application developer does not know it

2) add "Japanese cellphone mode"

If you turn it on, it accepts those bad addresses.

Pro: - only people who suffers the issue uses it Con: - the libary will not be "out of the box" for Japanese users

2-a) set it by constructor

2-b) set it by calling method after instantiaion

attached test code suggests this (method acceptJapaneseCellphoneAddress)

2-c) set it in configuration file

If a library user wants "warning", it is good if Swift_RfcComplianceException has more info, or specific subclass for "invalid RFC, but valid as Japanese cellphone address". Then it is possible for users to differenciate procedure afterwards. But it is not so mandatory as this can be also done outside of library before calling Swift Mailer.

And what to accept if the mode is set.

i) accept all of those invalid local part

ii) accept mail addresses by carriers who allowed invalid address

like what Gmail does. The patters are, as far as I know,

  • (local-part)@docomo.ne.jp
  • (local-part)@ezweb.ne.jp
  • (local-part)@[a-zA-Z0-9_]+.dion.ne.jp
  • (local-part)@[a-zA-Z0-9_]+.auone-net.jp

I attached an unit test code.

Comments and changes to this ticket

  • shin

    shin February 27th, 2010 @ 07:16 PM

    So, is anyone working on this problem?
    Actually, I'm having the exact same problem to send some email addresses such as:

    foo..@bar.com

    Of course, I KNOW this local part is wrong for RFC, but without accepting this local part, I cannot use Swiftmailer. I could use Swiftmailer when the version was 3 using Swift_RecipientList, but it seems the class has remove in version 4.

    The companties accept the wrong RFC are Docomo and Ezweb. They hold more than 70% share of Japanese cellphone, so this problem is very critical for web developers in Japan.

  • Maciej Lisiewski

    Maciej Lisiewski March 1st, 2010 @ 04:54 AM

    Changing _grammar['local-part'] in initializeGrammar() in AbstractHeader.php should do the trick. Have fun.

  • Fabien Potencier

    Fabien Potencier March 1st, 2010 @ 05:38 PM

    Some weeks ago, I started to refactored the code in v4.1. So, now, the grammar is in a dedicated class, which can be swapped by another one thanks to the dependency injection configuration. It's not perfect yet as tweaking the grammar involves some copy and paste. But at least, it is now possible to work around your problem.

  • shin

    shin March 2nd, 2010 @ 04:29 PM

    Thanks, Maciej, Fabien.

    Actually, as a temporal quick fix, I just commented out codes from _assertValidAddress in mailboxHeader.php, but it is not that file I want to fix. Same as fixing AbstractHeader.php as Maciej suggested.

    And I'm really looking forward to using next release of Swiftmailer, which Fabien is working on. Please give us polymorphic ways to fix this or give strict (non-strict) mode or Japanese cellphone mode.

    We still have other different issues to work swiftmailer in Japanese mailing properly. I would use swiftmailer to do this, and when I find some problem, I will let you know.

    Once again, Thank you for considering this issue. :)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Comprehensive mailing tools for PHP 5.

Shared Ticket Bins

People watching this ticket

Referenced by