Answer the question
In order to leave comments, you need to log in
Why doesn't the sender change when sending a letter?
I am making feedback on the site. The letter is sent, but the sender is always written as the one I have in MAIL_USERNAME
, regardless of what is in $message->from()
. How to change the sender? What am I doing wrong?
$mailTemplate = View::make('mails.feedback', [
'data' => $request->all()
]);
Mail::raw($mailTemplate, function($message) {
$message->from('[email protected]');
$message->to('[email protected]');
$message->setContentType('text/html');
$message->subject('Письмо с блога');
});
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=мой емаил
MAIL_PASSWORD=мой пароль
MAIL_ENCRYPTION=tls
Answer the question
In order to leave comments, you need to log in
And you thought Google would let you send through their servers from the left addresses? If you want to substitute - set up SPF on your domain and send from any name.
You can set up mail for a domain and send from various email boxes [email protected] . If you are interested in mail.ru: https://biz.mail.ru/mail/
You can also use Yandex.PDD , just keep in mind that in this case MAIL_USERNAME
it will have to match with $message->from()
for successful sending of letters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question