Send emails using Symfony's Mailer and MailerSend
Provides MailerSend integration for Symfony Mailer.
Symfony's Mailer & Mime components form a powerful system for creating and sending emails - complete with support for multipart messages, Twig integration, CSS inlining, file attachments, and more. Get them installed with the following:
composer require symfony/mailer-send-mailer
You'll now have a new line in your .env file that you can uncomment:
The MAILER_DSN isn't a real address: it's a convenient format that offloads most configuration work to the Mailer. The mailersend scheme activates the MailerSend component you just installed, which knows all about how to deliver messages via MailerSend. The only part you need to change is the KEY placeholder.
Each provider has different environment variables that the Mailer uses to configure the actual protocol, address, and authentication for delivery. The MailerSend component supports sending via API and SMTP. Symfony chooses the best available transport, but you can force to use one:
# force to use SMTP instead of HTTP (which is the default)
When using SMTP, the default timeout for sending a message before throwing an exception is the value defined in the default_socket_timeout PHP.ini option.