From d57dff8efdeedce0b1a2a6c7d70603de011d81c0 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Fri, 17 May 2024 20:03:56 +0200 Subject: [PATCH] more examples --- _documentation/emails.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/_documentation/emails.md b/_documentation/emails.md index c47a4ee8d..47d264cad 100644 --- a/_documentation/emails.md +++ b/_documentation/emails.md @@ -27,6 +27,12 @@ These are some examples to configure your SMTP for sending emails: More explanation can be found int the [Symfony mailer documentation](https://symfony.com/doc/current/mailer.html). +Some more complex examples for the default SMTP transport: + +- SMTP with authentication: `smtp://user:password@smtp.example.com:25` +- With email as username: `smtp://info@example.com:password@smtp.example.com:25` +- With TLS/SSL encryption: `smtp://info@example.com:password@smtp.example.com:443?encryption=ssl` + ## Troubleshooting You can test your email configuration by registering a new account or using the password reset function. @@ -40,19 +46,22 @@ To work around that waiting time, you can reset the timer by issuing the followi bin/console doctrine:query:dql "UPDATE App\Entity\User u SET u.passwordRequestedAt = null WHERE u.username = 'anna_admin'" ``` -### MAILER_URL with special character +### Error 500 when sending emails + +Some commonly used password characters can cause problems, which lead to a 500 error when trying to send an email. +Those could be for example: `@`, `+`, `:` or `#` - but other ones might be affected as well! -If your SMTP credentials contain special character like `@` or other ones which are not URL-safe, then they need to be urlencoded. -This can be done with one command, assuming your password is `mG0/d1@3aT.Z)s` then execute: +You need to encode them, so they can be safely used in the connection URL. +This can be done with one PHP command, assuming your password is `mG0/d1@3aT#Z+s1` then execute: ```bash -php -r "echo urlencode('mG0/d1@3aT.Z)s');" -mG0%2Fd1%403aT.Z%29s +php -r "echo urlencode('mG0/d1@3aT#Z+s1');" +mG0%2Fd1%403aT%23Z%2Bs1% ``` -Your `MAILER_URL` might look like this: +Your `MAILER_URL` would look like this: ``` -MAILER_URL="smtp://user:mG0%2Fd1%403aT.Z%29s@localhost:25" +MAILER_URL="smtp://user:mG0%2Fd1%403aT%23Z%2Bs1%@smtp.example.com:443?encryption=ssl" ``` ### SMTP does not accept emails