1

I hope I'm not in the wrong place for my problem, but I haven't found a solution for a week. I designed a new web application under Laravel 9 (now using Symfony Mailer). The problem is sending emails from accounts provided by Infomaniak. Shipping with OVH accounts or through MailHog and Mailtrap services works.

Error log:

local.ERROR: Expected response code "250" but got code "550", with message 
"550 5.7.1 Sender mismatch". 

{"exception":"[object] (
Symfony\\Component\\Mailer\\Exception\\TransportException(code: 550): 
Expected response code \"250\" but got code \"550\", with message 
\"550 5.7.1 Sender mismatch\". 
at /home/USER/www/APP/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php:308
)}

Under Laravel 8 (SwiftMailer) and earlier, it works.

Am I alone? Can anyone help me, thanks.

tanius
  • 14,003
  • 3
  • 51
  • 63
Boss COTIGA
  • 893
  • 7
  • 15

1 Answers1

1

Solution found with the help of a laracast.com user by replacing "from" to "replyTo"

In the App\Mail\ContactMail ($this->request->email from form in contact view through ContactRequest)

Old code

public function build()
{
    return $this->markdown('emails.resa')
        ->from($this->request->email)
        ->subject('Demande de réservation ' . config('app.name'));
}

Changed to

public function build()
{
    return $this->markdown('emails.resa')
        ->replyTo($this->request->email)
        ->subject('Demande de réservation ' . config('app.name'));
}
Boss COTIGA
  • 893
  • 7
  • 15
  • Context: [the laracast.com thread](https://laracasts.com/discuss/channels/laravel/laravel-9-symfony-mailer-550-571-sender-mismatch-by-infomaniak) that solved it. Explanation: you tried to send initially with a "From:" address of the user submitting the contact form. Infomaniak's e-mail server policy only allows "From:" addresses using the domain for which you have set up the Infomaniak e-mail service. – tanius Dec 30 '22 at 02:38