Skip to content

Conversation

@Benjamin-K
Copy link
Contributor

If the old SwiftMailer configuration had some special chars in their username like @, # or other special chars, the migrated DSN will be invalid. This leads to DSNs that will not work and show an error. To prevent this, all special chars in username and passwort are now urlencoded.

Fixes #2

Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Just wondering: Is it documented somewhere that URL encoding is the right solution for this?

@Benjamin-K
Copy link
Contributor Author

The Symfony Mailer Docs also mention this.

Warning

If the username, password or host contain any character considered special in a URI (such as : / ? # [ ] @ ! $ & ' ( ) * + , ; =), you must encode them. See RFC 3986 for the full list of reserved characters or use the urlencode function to encode them.

But thanks for your hint. I think we need to urlencode the domain, too.

If the old SwiftMailer configuration had some special chars in their username like @, # or other special chars, the migrated DSN will be invalid. This leads to DSNs that will not work and show an error. To prevent this, all special chars in username and passwort are now urlencoded.

Fixes neos#2
@Benjamin-K
Copy link
Contributor Author

Added urlencode to the host, too.

Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thx for the context. +1 by reading

@Benjamin-K Benjamin-K changed the title FIX: URL encode username and password in MailerService FIX: URL encode username, password and host in MailerService::createDsnFromSMTPSwiftMailerConfiguration() Oct 16, 2025
@Benjamin-K
Copy link
Contributor Author

@markusguenther Would you like to merge this and create a new version?

@markusguenther
Copy link
Member

@Benjamin-K Hey, thanks for this input and fix. Will take care tomorrow :)
Please ping me if it is not released next monday, then I forgot it 🙈

@markusguenther markusguenther self-assigned this Oct 30, 2025
Copy link
Member

@markusguenther markusguenther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Benjamin-K ❤️

@markusguenther markusguenther changed the title FIX: URL encode username, password and host in MailerService::createDsnFromSMTPSwiftMailerConfiguration() BUGFIX: URL encode username, password and host in MailerService::createDsnFromSMTPSwiftMailerConfiguration() Oct 31, 2025
@markusguenther markusguenther merged commit f463099 into neos:main Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid DSN creation, if SwiftMailer had special chars

3 participants