How i can change the sender using swiftmailer

Hi.

I have the following configuration for mail:




'class' => 'yii\swiftmailer\Mailer',

	'viewPath' => '@common/mail',

	'useFileTransport' => false, //for the testing purpose, you need to enable this

	'transport' => [

    	'class' => 'Swift_SmtpTransport',

    	'host' => 'smtp.googlemail.com',

    	'username' => 'adminemail@gmail.com,

    	'password' => 'the password',

    	'port' => '587', // Port 25 is a very common port too

    	'encryption' => 'tls', // It is often used, check your provider or mail server specs

	],



And in params.php I have the following:




<?php


return [

'adminEmail' => 'adminemail@gmail.com,

	// caducidad del token de renovación de la contraseña.

	'user.passwordResetTokenExpire' => 3600,

];



The email sender works ok on registering and reseting passwords but in contact form, which the sender (email from) is the email set in the form, is the same username in mail config what is too strange because the code is just like was made by the app-advanced template:




public function sendEmail($email) {

    	return Yii::$app->mailer->compose()

                    	->setTo($email)

                    	->setFrom([$this->email => $this->name])

                    	->setSubject($this->subject)

                    	->setTextBody($this->body)

                    	->send();

	}



The setFrom method is supposed to add the name and email sender. the setTo works because the emails arrives to adminEmail inbox, but as I say, the setFrom method is not accomplishing its purpose.

Then my question is to know if is a bug, a mistake…

Regards.