Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Japanese cellphone address needs to bypass RFC validation #71

Closed
swiftmailer opened this issue Sep 2, 2011 · 4 comments
Closed

Japanese cellphone address needs to bypass RFC validation #71

swiftmailer opened this issue Sep 2, 2011 · 4 comments

Comments

@swiftmailer
Copy link
Collaborator

Bizzae Japanese Mobile Mail Address

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

  1. Local part ends with period

bar.@example.com

  1. 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
  1. 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.

Original creation date: 2009-10-07T08:06:10Z
Original reporter: shin
Original ticket: http://swiftmailer.lighthouseapp.com/projects/21527/tickets/110

@swiftmailer
Copy link
Collaborator Author

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.

Original creation date: 2010-02-27T08:16:16Z
Original reporter: shin

@swiftmailer
Copy link
Collaborator Author

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

Original creation date: 2010-02-28T17:54:21Z
Original reporter: Maciej Lisiewski

@swiftmailer
Copy link
Collaborator Author

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.

Original creation date: 2010-03-01T06:38:03Z
Original reporter: Fabien Potencier

@swiftmailer
Copy link
Collaborator Author

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. :)

Original creation date: 2010-03-02T05:29:44Z
Original reporter: shin

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant