[GH-ISSUE #633] Impossible to send mail from Symfony since 1.28.3 #394

Closed
opened 2026-03-15 14:13:58 +03:00 by kerem · 6 comments
Owner

Originally created by @maixal on GitHub (Jan 27, 2026).
Original GitHub issue: https://github.com/axllent/mailpit/issues/633

Hi,

In 1.28.2, mailpit works perfectly.

In 1.28.3, i have this error :
Process failed with exit code 1: sendmail: 501 5.5.4 Syntax error in parameters or arguments (invalid FROM parameter)

In 1.28.4, i have this error :
Process failed with exit code 1: sendmail: 553 5.1.3 The address is not a valid RFC 5321 address

I use Symfony 7.3.

Here the code to send an email :

$emailTo = 'test@gmail.com';
$email = (new TemplatedEmail())
    ->to($emailTo)
    ->subject("TEST")
    ->htmlTemplate('emails/admin/demande_test.html.twig');

$this->mailer->send($email);

It not have "FROM" but when i have from() it's same error :

$emailTo = 'test@gmail.com';
$email = (new TemplatedEmail())
    ->from('toto@gmail.com')
    ->to($emailTo)
    ->subject("TEST")
    ->htmlTemplate('emails/admin/demande_test.html.twig');

$this->mailer->send($email);

Thanks to fix it or add an option to disable the new feature...

Originally created by @maixal on GitHub (Jan 27, 2026). Original GitHub issue: https://github.com/axllent/mailpit/issues/633 Hi, In 1.28.2, mailpit works perfectly. In 1.28.3, i have this error : `Process failed with exit code 1: sendmail: 501 5.5.4 Syntax error in parameters or arguments (invalid FROM parameter)` In 1.28.4, i have this error : `Process failed with exit code 1: sendmail: 553 5.1.3 The address is not a valid RFC 5321 address` I use Symfony 7.3. Here the code to send an email : ```php $emailTo = 'test@gmail.com'; $email = (new TemplatedEmail()) ->to($emailTo) ->subject("TEST") ->htmlTemplate('emails/admin/demande_test.html.twig'); $this->mailer->send($email); ``` It not have "FROM" but when i have from() it's same error : ```php $emailTo = 'test@gmail.com'; $email = (new TemplatedEmail()) ->from('toto@gmail.com') ->to($emailTo) ->subject("TEST") ->htmlTemplate('emails/admin/demande_test.html.twig'); $this->mailer->send($email); ``` Thanks to fix it or add an option to disable the new feature...
kerem 2026-03-15 14:13:58 +03:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@axllent commented on GitHub (Jan 28, 2026):

I'm really not sure what could be causing this issue, other than than your Symfony mailer is not sending using an RFC-compliant address. Have you looked at the Mailpit log to see if it provides any clues as to what is wrong? In 1.28.4 I changed the error message to provide better clarity as to why it is failing, which is caused by:
a) a space somewhere between < and > in the FROM: <...>, or
b) an invalid email address between the < and > in the FROM: <...>

<!-- gh-comment-id:3809965994 --> @axllent commented on GitHub (Jan 28, 2026): I'm really not sure what could be causing this issue, other than than your Symfony mailer is not sending using an RFC-compliant address. Have you looked at the Mailpit log to see if it provides any clues as to what is wrong? In 1.28.4 I changed the error message to provide better clarity as to why it is failing, which is caused by: a) a space somewhere between `<` and `>` in the `FROM: <...>`, or b) an invalid email address between the `<` and `>` in the `FROM: <...>`
Author
Owner

@maixal commented on GitHub (Jan 28, 2026):

Here the log :

time="2026/01/28 10:30:33" level=debug msg="[smtpd] response (172.20.0.4) 220 mail Mailpit ESMTP Service ready"
time="2026/01/28 10:30:33" level=debug msg="[smtpd] received (172.20.0.4) HELO php83.dev.local"
time="2026/01/28 10:30:33" level=debug msg="[smtpd] response (172.20.0.4) 250 mail greets php83.dev.local"
time="2026/01/28 10:30:33" level=debug msg="[smtpd] received (172.20.0.4) MAIL FROM:<www-data@php83.dev.local\r>"
time="2026/01/28 10:30:33" level=error msg="[smtpd] response (172.20.0.4) 553 5.1.3 The address is not a valid RFC 5321 address"
<!-- gh-comment-id:3810458555 --> @maixal commented on GitHub (Jan 28, 2026): Here the log : ```text time="2026/01/28 10:30:33" level=debug msg="[smtpd] response (172.20.0.4) 220 mail Mailpit ESMTP Service ready" time="2026/01/28 10:30:33" level=debug msg="[smtpd] received (172.20.0.4) HELO php83.dev.local" time="2026/01/28 10:30:33" level=debug msg="[smtpd] response (172.20.0.4) 250 mail greets php83.dev.local" time="2026/01/28 10:30:33" level=debug msg="[smtpd] received (172.20.0.4) MAIL FROM:<www-data@php83.dev.local\r>" time="2026/01/28 10:30:33" level=error msg="[smtpd] response (172.20.0.4) 553 5.1.3 The address is not a valid RFC 5321 address" ```
Author
Owner

@maixal commented on GitHub (Jan 28, 2026):

I have found the issue ! It's default behaviour of ssmtp.

By default, on alpine, php use ssmtp service for relay email.
By default, ssmtp set phpuser@host as FROM for email.

I have set FromLineOverride=YES in /etc/ssmtp/ssmtp.conf and now it's works because i can overwrite FROM inside Symfony.

But i think, you will have the issue with all php users which uses ssmtp...

<!-- gh-comment-id:3810594005 --> @maixal commented on GitHub (Jan 28, 2026): I have found the issue ! It's default behaviour of ssmtp. By default, on alpine, php use ssmtp service for relay email. By default, ssmtp set phpuser@host as FROM for email. I have set `FromLineOverride=YES` in `/etc/ssmtp/ssmtp.conf` and now it's works because i can overwrite FROM inside Symfony. But i think, you will have the issue with all php users which uses ssmtp...
Author
Owner

@axllent commented on GitHub (Jan 28, 2026):

Actually phpuser@host is perfectly ok, but what is definitely NOT ok is the trailing carriage return \r at the end: FROM:<www-data@php83.dev.local\r>".

This would (or at least should) fail validation on any RFC-compliant SMTP server, and is even related to a recent Mailpit security advisement @ CVE.

Did you by any chance create or edit the ssmtp configuration file(s) using something like Notepad on Windows? I'm just trying to work out the origin of the \r character.

<!-- gh-comment-id:3813186117 --> @axllent commented on GitHub (Jan 28, 2026): Actually `phpuser@host` is perfectly ok, but what is definitely NOT ok is the trailing carriage return `\r` at the end: `FROM:<www-data@php83.dev.local\r>"`. This would (or at least should) fail validation on any RFC-compliant SMTP server, and is even related to a recent Mailpit security advisement @ CVE. Did you by any chance create or edit the ssmtp configuration file(s) using something like Notepad on Windows? I'm just trying to work out the origin of the `\r` character.
Author
Owner

@maixal commented on GitHub (Jan 29, 2026):

Yes it was a problem with EOL between CRLF and LF on ssmtp.conf :s

<!-- gh-comment-id:3815887384 --> @maixal commented on GitHub (Jan 29, 2026): Yes it was a problem with EOL between CRLF and LF on ssmtp.conf :s
Author
Owner

@axllent commented on GitHub (Jan 29, 2026):

Thanks for the feedback, that explains it. My guess is that ssmtp parses the configuration file manually line by line, split by \n, meaning the\r remains. If this is considered a bug, then it's an ssmtp bug - but then again, never edit anything with notepad 😃

<!-- gh-comment-id:3815918912 --> @axllent commented on GitHub (Jan 29, 2026): Thanks for the feedback, that explains it. My guess is that ssmtp parses the configuration file manually line by line, split by `\n`, meaning the`\r` remains. If this is considered a bug, then it's an ssmtp bug - but then again, never edit **anything** with notepad 😃
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#394
No description provided.