Symfony's Mailer component helps sending emails and provides integration with the most popular mailing services.
Questions tagged [symfony-mailer]
75 questions
0
votes
1 answer
Symfony: How to send a file as email-attachment without saving it
I am using symfony 6.1. I have a form that accepts a file upload which works as far as I can see.
The form is not backed by an entity and in this particular case I don't really see the necessity to save the uploaded file somewhere. It would be…

Wolfone
- 1,276
- 3
- 11
- 31
0
votes
2 answers
Syntax error, unexpected token ")" when sending mail in laravel 8
I know the title seems familiar but hear me out...
My code works locally when I try to send out an invoice via email and the email gets sent. However, I deployed the same code to production on ec2 and got this error;
My controller looks like…

Lyndon
- 183
- 3
- 14
0
votes
1 answer
Symfony Mailer email sent in profiler but not received
I try to send email with symfony. I use this code :
$email = (new TemplatedEmail())
->from('myemail@mydomain.com')
->to('mypersonnaltestingemail@gmail.com')
->subject('Nouvelle demande de devis !')
…

Léane Barbotin
- 11
- 2
0
votes
3 answers
How do I use Monolog with Symfony Mailer on Laravel 9?
I want that all errors that are logged with Monolog in my Laravel 9 application are sent to a predefined email address. Using SwiftMailer with Monolog has been deprecated (see this PR). Instead, Symfony Mailer should be used.
How do I use Monolog…

askuri
- 345
- 3
- 10
0
votes
2 answers
Mail stay in queue when i use Sendgrid in symfony6
I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://@default
Then i try to test integration in Sendgrid by clicking on button…

Tom60
- 1
- 2
0
votes
1 answer
Laravel 9.x new Symphony Mailer Transport dynamic change
Before Laravel switched to Symfony Mailer I was able to check custom SMTP server response the following way:
try {
$transport = new Swift_SmtpTransport($request->smtp_server, $request->smtp_port, $request->secure_connection);
…

user3077845
- 13
- 4
0
votes
1 answer
Symfony doesn't autowire Sendmail Transport from MAILER_DSN
I want to use Symfony Mailer in a Symfony 6 application.
I have configured following files, like explained the docs.
// .env
MAILER_DSN=sendmail://default?command=/usr/bin/sendmail%20-t
// .config/packages/mailer.yaml
framework:
mailer:
…

Benni
- 1,023
- 11
- 15
0
votes
1 answer
How do I configure Symfony Mailer with Silverstripe?
I am new to Silverstripe and currently doing the lessons. The version is 4.10 which has dropped support for Swiftmailer and are recommending Symfony Mailer. I have installed Symfony Mailer using Composer. There was a Symfony folder in the root…

Bululu
- 555
- 2
- 8
- 14
0
votes
1 answer
How to style (HTML) Monolog emails sent via Symfony Mailer
Due to depreciation, I'm converting my Monolog email logging from Swiftmailer to Symfony Mailer (as recommended here).
I have successfully completed the conversion and am receiving the emails.
However, with Swift Mailer all Monolog emails were…

GlennM
- 300
- 1
- 14
0
votes
0 answers
Unit testing Symfony 5 Mailer: MessageLoggerListener not available
I want to test email delivery in Behat tests in Symfony 5. Apparently, there is a MailerAssertionsTrait in the PHPUnit package for Symfony which uses the MessageLoggerListener to check the sent emails. Following this tutorial…

Subsurf
- 1,256
- 1
- 17
- 28
0
votes
3 answers
Return body of Symfony Mailer email in a functional test?
With Mailer, it appears not possible to retrieve the body of an email in a functional test. For example, with
$email = $this->getMailerMessage(0);
$body = $email->getBody();
var_dump($body);
$body is revealed…

geoB
- 4,578
- 5
- 37
- 70
0
votes
3 answers
How to get list of available mail transports in an application?
I have a problem to get list of all transports defined for mailer component.
In my config/packages/mailer.yaml I have defined three transports:
framework:
mailer:
transports:
default: '%env(MAILER_DEFAULT_DSN)%'
…

aslawin
- 1,981
- 16
- 22
0
votes
1 answer
Symfony Mailer configure sendmail parameters
we are using symfony/mailer in our project and i was wondering how i can configure the sendmail command with custom paramters. i found alot of content referencing to swiftmailer but we do not use that on this project.
we use:
symfony/mailer …

netzding
- 772
- 4
- 21
-1
votes
3 answers
Symfony Mailer - Migrate addPart from SwiftMailer
I am migrating from SwiftMailer to Symfony Mailer in my application.
How to migrate addPart method of SwiftMailer to Symfony Mailer? In my case the content type is text/plain
->addPart('Plain text content', 'text/plain');
using
swiftmailer…

Filip Kaszczyński
- 139
- 1
- 2
- 15
-1
votes
2 answers
Symfony 5.3 Mailer setup env vars not reading correctly
In a Symfony 5.3 project I am using the Mailer (..\Symfony\Component\Mailer\MailerInterface) to send mails.
For devolopment I required "symfony/google-mailer" with composer and set it up in .env.local.
Say username is "example@gmail.com" and…

user3440145
- 793
- 10
- 34