Skip to content
Yannick Warnier edited this page May 23, 2024 · 2 revisions

Messaging (e-mails, mostly) in Chamilo 2 is a bit different from Chamilo 1, because of using Symfony.

The general logic is that we use the Messenger transport component, which is highly configurable.

By default, we use a simple synchronous messaging mechanism, which works similarly to Chamilo 1: we send e-mails through the MailHelper class (Send() method) directly. So if you send 10k e-mails through a slow SMTP connection, it will take a considerable amount of time.

However, and this is where we enjoy Symfony's large palette of options, you can use new messenger transports by defining MESSENGER_TRANSPORT_DSN in .env, loading the required dependency, and updating messenger.yaml by enabling the @prod section towards the end.

Once enabled (and the cache has been cleared), any message sent through Chamilo will pass through the configured messenger.

Setting up Doctrine Messenger

Doctrine Messenger is a DB table-based message queue.

To enable:

  • add "doctrine/doctrine-messenger" to composer.json
  • composer install
  • edit config/messenger.yaml
  • uncomment the 2-parts @prod block at the end
  • edit .env
  • set MESSENGER_TRANSPORT_DSN=doctrine://messenger
  • php bin/console cache:clear

Setting up AWS SES

To enable:

  • add "doctrine/doctrine-messenger" to composer.json
  • composer install
  • edit config/messenger.yaml
  • uncomment the 2-parts @prod block at the end
  • edit .env
  • set MESSENGER_TRANSPORT_DSN=ses+smtp://ACCESS_KEY:SECRET_KEY@default?region=REGION
  • php bin/console cache:clear
Clone this wiki locally