1

I'm trying to send emails through swiftmailer in a Symfony 4 application. Here is my swiftmailer.yaml config file :

swiftmailer:
    mailers:
        mailer_smtp:
            url: '%env(MAILER_URL)%'
            spool: { type: 'memory' }
            transport: smtp
            host: xxxxxxxxxxxxxx
            port: 25
            encryption:
            username:
            password:
            auth_mode: login
    default_mailer: mailer_smtp

I can send emails to local addresses only, when I try to send an email to an external address I get this :

app.ERROR: Exception occurred while flushing email queue: Expected response code 354 but got code "503", with message "503 5.5.2 Need rcpt command "

I have another PHP application (not using Symfony or swiftmailer) that send emails to any address (local or external) with a similar configuration : connection on port 25, no auth required. This is allowed on our exchange server, as long as the source IP is authorized.

I changed my swiftmailer.yaml this way :

swiftmailer:
    mailers:
        mailer_smtp:
            url: '%env(MAILER_URL)%'
            spool: { type: 'memory' }
            transport: smtp
            host: xxxxxxxxxxxxx
            port: 25
            encryption:
            username:  xxxxxxxx@xxxxx.xx
            password: xxxxxxx
            auth_mode: login
    default_mailer: mailer_smtp

And then I get this error, to any address (external or local email) :

app.ERROR: Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "xxx" using 0 possible authenticators. [] []

If the fonction that sends the email, I'm using in the SetFrom property the same user I filled in swiftmail.yaml :

 $message = (new Swift_Message($evenement->getNomEvenement()))
            ->setFrom("xxxxxxxx@xxxxx.xx")
            ->setTo($mail)

Do you have any idea to solve this?

Thanks for your help

Antoine
  • 41
  • 2
  • Does this answer your question? [Laravel mail sending through smtp server error 503 5.5.2](https://stackoverflow.com/questions/53703883/laravel-mail-sending-through-smtp-server-error-503-5-5-2) – Justinas May 12 '21 at 08:21
  • Thanks for replying. Unfortunately, none of the solutions described in this page worked for me :( – Antoine May 17 '21 at 10:21

0 Answers0