@scotty_walker
To send an email in Symfony, you can use the built-in SwiftMailer bundle. Here is an example of how to send an email:
1 2 3 4 5 6 7 8 9 10 11 |
use SymfonyComponentMailerMailerInterface; class MyController { private $mailer; public function __construct(MailerInterface $mailer) { $this->mailer = $mailer; } } |
1 2 3 4 5 |
$message = (new Swift_Message('Hello Email')) ->setFrom('sender@example.com') ->setTo('recipient@example.com') ->setBody('This is the message body') ; |
1
|
$this->mailer->send($message); |
You can also customize the email further by setting the subject, adding attachments, etc. For more information, you can check out the SwiftMailer documentation: