Problem/Motivation
I cannot send emails to addresses with non-ASCII characters. Sending fails with the following exception (caught in Swift_Transport_AbstractSmtpTransport::doMailTransaction:
Swift_AddressEncoderException: Non-ASCII characters not supported in local-part
I tried enabling SMTPUTF8 support by adding the following to TransportFactory::getTransport:
$transport->setExtensionHandlers(array_merge(
$transport->getExtensionHandlers(),
[new Swift_Transport_Esmtp_SmtpUtf8Handler()]
));
$transport->setAddressEncoder(new Swift_AddressEncoder_Utf8AddressEncoder());
That fixes the first error, but now it fails with the following error:
Expected response code 250/251/252 but got code "501", with message "501 Invalid RCPT TO address provided"
I tested with version 2.0.0-beta1.
Steps to reproduce
Send an email to an address with non-ASCII characters. eg. aydıgan@example.com.
Proposed resolution
Remaining tasks
Comments
Comment #2
geek-merlinThis sounds like a support question to the upstream library, or better, StackOverflow.
Did you realize this in the class docs:
"f your outbound SMTP server does not support SMTPUTF8, use Swift_AddressEncoder_IdnAddressEncoder instead."
Comment #3
dieterholvoet commentedI saw that, but when using
Swift_AddressEncoder_IdnAddressEncoderit throws the following error:I think the error I attached in the issue description happened because our email provider, Amazon SES, does not support SMTPUTF8. There doesn't seem to be a way to use non-ASCII characters in the local-part when you email provider does not support SMTPUTF8. Not sure if this is a bug or a misconfiguration of SwiftMailer. If it's a misconfiguration, maybe we could consider changing that in the module, if not it's something for the upstream library.