A
A
Artem Prokhorov2021-07-05 16:48:35
Yii
Artem Prokhorov, 2021-07-05 16:48:35

Why does swiftmailer duplicate sent email to username's address?

Config:

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            'useFileTransport' => false,
            'transport' => [
                'class'      => 'Swift_SmtpTransport',
                'host'       => 'smtp.gmail.com',
                'username'   => '******@gmail.com',
                'password'   => '*****',
                'port'       => '587',
                'encryption' => 'tls',
            ],
        ],

Send code in method:
Yii::$app->mailer->compose()
                ->setFrom('[email protected]')
                ->setTo($email)
                ->setSubject('2')
                ->setHtmlBody('<b>2</b>')
                ->send();


The letter then reaches, but for example, if I send it with , then in the incoming letter in the line "from" the mail from the config will be indicated . Moreover, for some reason, the letter is duplicated in [email protected] itself. How to fix it? ->setFrom('[email protected]')'username' => '[email protected]',

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question