i am using swiftmailer with below config
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'admin@gmail.com',
'password' => 'password',
'port' => '587',
'encryption' => 'tls',
],
in the controler
Yii::$app->mailer->compose([
'html' => 'Confirmation-html',
], [
'user' => $user,
'profile' => $profile,
])
->setFrom(['newadmin@domain.com'=>'New admin'])
->setTo($user->email)
->setSubject(Yii::t('app','Your account was created(1)'))
->send();
the email is sent but the email sender is still admin@gmail.com with name ‘New admin’ and not newadmin@domain.com with name ‘New admin’
please can someone let me know what i am doing wrong.
Thank you