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

OroEmailBundle can't send email with Amazon SES #1094

Open
jimohalloran opened this issue Jan 30, 2023 · 1 comment
Open

OroEmailBundle can't send email with Amazon SES #1094

jimohalloran opened this issue Jan 30, 2023 · 1 comment

Comments

@jimohalloran
Copy link

Summary
After instaling the symfony/amazon-mailer package and configuring the mailer_dsn (tried the ses://, ses+https:// and ses+api:// schemes), OroCRM is unable to send the new user invitation email successfully. The UI shows both User saved. and An invitation email sending was failed, but there is an RfcComplianceException in the logs:

app.ERROR: Invitation email sending failed. {"exception":"[object] (Symfony\\Component\\Mime\\Exception\\RfcComplianceException(code: 0): Email \"01080185f0f5aa0b-56ed55a5-a3f1-42ef-b5df-ff3744d8cf2b-000000\" does not comply with addr-spec of RFC 2822. at /var/www/html/oro/vendor/symfony/mime/Address.php:56)"} []

The user receives the email, the issue is the failure that appears in the UI and the exception in the logs.

Steps to reproduce
Install an unmodified OroCRM 5.0.x application. Configure to use Amazon SES. Add a new user and attempt to send the invitation email.

Actual Result
The new user receives the email, but there is an error message displayed in the UI, and a RfcComplianceException in the logs.

Expected Result
The new user receives the email, and no error is shown in the UI, nor is the RfcComplianceException logged.

Details about your environment

  • OroPlatform version: 5.0.10
  • PHP version: 8.1
  • Database (MySQL, PostgreSQL) version: MySQL 8
  • [Optional] Server operating system: Rocky Linux 9.1 (64bit)
  • [Optional] Installed extensions and any added customizations: symfony/amazon-mailer 6.2 for SES support in Symfony Mailer.

Additional information
Doing some debugging around the exception leads me to think this is at least partially an Oro Platform issue. After the email is sent Oro Platform (Oro/Bundle/EmailBundle/Mailer/Mailer.php:32) gets the MessageID from the sent message and assign it to the Id header of the message entity. This fails because the SES transport returns a temporary ID generated by Symfony, not an email address like string (the actual MessageID). This then fails validation, and the exception is thrown.

Seems like not all message transports are created equal, some some don't return the actual MessageID, but Oro is assuming they do. (See: symfony/symfony#33681) That issue mentions specifically not using the SMTP transport for SWS, but I'm having issues with all of the schemes as you can see above.

So it seems like SES + Oro Platform can't possibly work as is. Seems hard to believe that no one uses Oro Platform + SES with Symfony Mailer, but the two seem fundamentally incompatible as is.

@jimohalloran
Copy link
Author

SendGrid with the sendgrid+api:// scheme has the same issue as well. A temporary MessageID is returned that does not look like an email address, therefore the exception is raised even though the email is sent.

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

No branches or pull requests

1 participant