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

If error occurs on sending email for double optin, "Oops an error occurred" is displayed (instead of flash message) #1115

Open
sypets opened this issue Aug 29, 2024 · 3 comments

Comments

@sypets
Copy link
Contributor

sypets commented Aug 29, 2024

I tested this with a wrong not existing email and also a wrongly configured email configuration with same results.

I expect a flash message to appear, not an exception. If the email fails in the next stage (e.g. mail to receiver) it does not throw exception, but shows a flash message theoretically (if not for #1108, #1087 etc - which I did not check now, if still reprodible).

This behaviour is inconsistent.

Also, I think this is new and previously this "seemed" to work and a confirmation messages was displayed (which is also not right).

Reproduce

  1. Create working form with double-optin and an email field

image

image

  1. In the frontend, fill out not existing email and submit form

Expected: Flash message with error message

Actual result:

Oops, an error occurred! Code: 202408291448112ee11570

Versions

  • TYPO3 : latest 12.4 branch (from git)
  • powermail: lastest master branch (shows version 12.4.0)

Additional context

I installed with latest master and without additional extensions to rule out side effects, so it is simple configuration with defaults.

I am on a system where I immediately get error if mail fails (configured via SMTP). This is not always the case, see Avoid sending bounces from your server, so depending on email configuration, a bounce email might be sent instead and the user sees no error at all.

Exception

Thu, 29 Aug 2024 16:30:31 +0200 [ALERT] request="9f13f63495e73" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler":
 Oops, an error occurred! Code: 202408291630305b25c4b1- UnexpectedResponseException: 
Expected response code "250/251/252" but got code "550", with message "550 5.1.1 
<fehlerhafte-email@******>... User unknown"., 
in file /var/www/t3coredev12/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php:333 - 
{"exception":"Symfony\\Component\\Mailer\\Exception\\UnexpectedResponseException: Expected response code \"250/251/252\" but got code \"550\", with message \"550 5.1.1 <[email protected]>... User unknown\". in /var/www/t3coredev12/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php:333

Stack trace:

#0 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(201): Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport->assertResponseCode()
#1 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/Smtp/EsmtpTransport.php(117): Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport->executeCommand()
#2 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(259): Symfony\\Component\\Mailer\\Transport\\Smtp\\EsmtpTransport->executeCommand()
#3 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(218): Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport->doMailFromCommand()
#4 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/AbstractTransport.php(90): Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport->doSend()
#5 /var/www/t3coredev12x/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(137): Symfony\\Component\\Mailer\\Transport\\AbstractTransport->send()
#6 /var/www/t3coredev12x/typo3/sysext/core/Classes/Mail/Mailer.php(111): Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport->send()
#7 /var/www/t3coredev12x/typo3/sysext/core/Classes/Mail/MailMessage.php(54): TYPO3\\CMS\\Core\\Mail\\Mailer->send()
#8 /var/www/t3coredev12x/typo3conf/ext/powermail/Classes/Domain/Service/Mail/SendMailService.php(148): TYPO3\\CMS\\Core\\Mail\\MailMessage->send()
#9 /var/www/t3coredev12x/typo3conf/ext/powermail/Classes/Domain/Service/Mail/SendMailService.php(107): In2code\\Powermail\\Domain\\Service\\Mail\\SendMailService->prepareAndSend()
#10 /var/www/t3coredev12x/typo3conf/ext/powermail/Classes/Domain/Service/Mail/SendOptinConfirmationMailPreflight.php(83): In2code\\Powermail\\Domain\\Service\\Mail\\SendMailService->sendMail()
#11 /var/www/t3coredev12x/typo3conf/ext/powermail/Classes/Controller/FormController.php(337): In2code\\Powermail\\Domain\\Service\\Mail\\SendOptinConfirmationMailPreflight->sendOptinConfirmationMail()
#12 /var/www/t3coredev12x/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php(479): In2code\\Powermail\\Controller\\FormController->createAction()
....

stack_trace_powermail_email.txt

@mschwemer
Copy link
Collaborator

I think, I understand what happens. But I am not able to reproduce it locally. :-/

Just a few more questions to narrow it down:

  • What happens, if you use fehlerhafte-email@*** in a form, without double-opt-in? I would also expect an exception, because the used sendmail service is the same.

  • What happens, if you send and email with fehlerhafte-email via "Admin Tools" => "Environment" => "Test Mail Setup"?

I fear, that this is a "special case", which could be fixed, but (probably) needs individual funding due to the special SMTP server setup.

@sypets
Copy link
Contributor Author

sypets commented Oct 10, 2024

Thank you Markus, I will try to reproduce and get back to you.


Btw, for testing I am very happy with "mailpit". Very easy to install and setup. This runs on the server or locally and can be used as "Fake" E-Mail server.

You can configure specific email adresses as valid so it is easy to simulate error behaviour without spamming yourself. (What I was not able to do yet is simulate wrong "From" addresses, it does not seem to be possible).

For example I use (locally, you don't need to specify the certs if you do not need encryption):

/usr/local/bin/mailpit -d /var/lib/mailpit/mailpit.db --smtp-allowed-recipients @(example.com|example.org)$ --ui-tls-cert /etc/letsencrypt/archive/myserver/cert7.pem --ui-tls-key /etc/letsencrypt/archive/myserver/privkey7.pem -v --log-file /var/log/mailpit.log

So only, the example.org and example.com are considered valid (just as an example).

I am using .env connector so this is my setup:

t3_conf_vars_MAIL_transport='smtp'
t3_conf_vars_MAIL_transport_smtp_server='0.0.0.0:1025'
t3_conf_vars_MAIL_transport_smtp_username=
t3_conf_vars_MAIL_transport_smtp_password=

Then I can view my incoming mails with http://localhost:8025

@sypets
Copy link
Contributor Author

sypets commented Oct 10, 2024

I used latest master with TYPO3 v12. I could not reproduce an "oops an error occured", but I also did not see a flash message.

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

2 participants