Swiftmailer not sending mails [SOLVED]


I have tried several hours to make Swiftmailer send mails out, but I can’t make it work.

This is from my config:

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'useFileTransport' => false,
        'transport' => [
        'class' => 'Swift_SmtpTransport',
        'host' => 'smtp1.servage.net',
        'username' => 'myusername',
        'password' => 'mypassword',
        'port' => '25',

When sending mails, everything works out fine except there comes no mails. There are no errors.

If, however, I change the password to something wrong, I’ll get an authentication error:

Failed to authenticate on SMTP server with username “myusername” using 3 possible authenticators 181

Can anybody shed some light on what’s wrong?


it will be really difficult to tell what is wrong by just looking at the config

I understand that.

I have another STMP account which I can use on the remote server. On that account there is no password since it is only working from the specific server.

When I try with that account, I get:

Failed to authenticate on SMTP server with username "xxx" using 2 possible authenticators 181

Sending with plain PHP works.

Does Switftmailer have a problem with blank passwords?

I think in order to not use any password, I need to disable STMP authentication. How do I do that in Swiftmailer?

In PHPMailer I do it like this: $mail->SMTPAuth = false;

Ok, both problems solved.

  1. The first mentioned smtp server is actually extremely slow. After several hours, mails are starting to arrive.

  2. When not using any authentication, BOTH username and password must be empty or omitted. In PHPMailer, it doesn’t matter if only you set SMTPAuth = false;