Skip to content
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

[RFC]: UTF-8 (SMTPUTF8) support #180

Open
boesing opened this issue Feb 18, 2022 · 0 comments
Open

[RFC]: UTF-8 (SMTPUTF8) support #180

boesing opened this issue Feb 18, 2022 · 0 comments

Comments

@boesing
Copy link
Member

boesing commented Feb 18, 2022

RFC

Q A
Proposed Version(s) 3.0.0
BC Break? Yes

Goal

Providing proper UTF-8 support for laminas-mail.
Would fix #71
Would fix #67
Would fix #57

Background

I've found myself working on a fork from Zend_Mail which was basically created to allow UTF-8 characters when parsing E-Mails from string. Main purpose was to allow UTF-8 subjects and UTF-8 E-Mail address.

Considerations

I've played a little bit around and since almost everything is finally verified by HeaderValue#isValid, I think we have to tackle that one.

I was thinking about adding another argument to HeaderValue#isValid to add "extensions".
So maybe something like:

final class HeaderValue
{
    public const EXTENSION_NONE = 0;
    public const EXTENSION_SMTPUTF8 = 1;

    /**
     * @psalm-param int-mask-of<HeaderValue::EXTENSION_*> $withExtensions
     */
    public static function isValid(string $value, int $withExtensions = self::EXTENSION_NONE): bool
    {
    }
}

Yes - another bitmask (but TBH - I don't see how to add something like this without actually having a bitmask).
This would actually allow us allowing the SMTPUTF8 extension from outside.

I'd say, when reading an E-Mail from Imap or Pop3 (is this still a thing?) - we should allow SMTPUTF8 since if the mail does contain UTF-8 headers, it is due to the fact that a server actually delivered that mail - right?

So now we have to somehow pass that extension information through all headers - and also to the Message (in case we are parsing an existing mail).

Proposal(s)

Implement a generic way to allow SMTP extensions from these methods:

  • Headers#fromString
  • Message#fromString

Appendix

None so far. Happy to hear your thoughts about this as I definitely would love to get rid of that Zend_Mail fork.

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

No branches or pull requests

1 participant