Answer the question
In order to leave comments, you need to log in
How to send a letter using mailer, from the mail I need?
Config:
"mailer" : {
"class" : "yii\\swiftmailer\\Mailer",
"useFileTransport": false,
"transport": {
"class" : "Swift_SmtpTransport",
"host" : "smtp.yandex.ru",
"username": "mail1",
"password": "somepassword",
"port" : "465",
"encryption" : "ssl"
}
}
Yii::$app->mailer->compose()
->setFrom('mail2')
->setTo('reciver')
->setSubject('Тема сообщения')
->setTextBody('Текст сообщения')
->send();
"Expected response code 250 but got code "553", with message "553 5.7.1 Sender address rejected: not owned by auth user.
Answer the question
In order to leave comments, you need to log in
As far as I can see, mail1 does not pass authorization, most likely you need to either enable the portal password in the settings (they called it that usual) or use application passwords.
But in general, a very bad option. On the one hand, Yandex can block sending via its SMTP, I wrote more in this article
https://7fk.ru/nastroyka-smtp/
On the other hand, sending via mail1 with the from mail2 field will be perceived by all mailers as spoofing and letters will not get everywhere even in the spam folder
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question