gpt4 book ai didi

php - 无法在 laravel 5.2 中发送没有发件人地址的消息 我已经设置了 .env 和 mail.php

转载 作者:行者123 更新时间:2023-12-05 08:14:41 25 4
gpt4 key购买 nike

在忘记密码的情况下,laravel 发送的电子邮件会给出如下错误:

Swift_TransportException in AbstractSmtpTransport.php line 162:

没有发件人地址无法发送消息

我已经在 .envmail.php 中设置了我的邮件帐户详细信息。

我的.env:

MAIL_DRIVER=smtp
MAIL_HOST=smtp-mail.outlook.com
MAIL_PORT=587
MAIL_USERNAME=raval_himanshu@live.in
MAIL_PASSWORD=pass
MAIL_ENCRYPTION=tls

我的mail.php是

<?php

return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp-mail.outlook.com'),

'port' => env('MAIL_PORT', 587),

'from' => ['raval_himanshu@live.in' => null, 'Himanshu Raval' => null],

/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/

'username' => env('raval_himanshu@live.in'),



'sendmail' => '/usr/sbin/sendmail -bs',

];

我也试过 php artisan config:cache 但之后它给出了同样的错误。

最佳答案

我在 mail.php 中出错了

'from' => ['raval_himanshu@live.in' => null, 'Himanshu Raval' => null],

应该是

'from' => ['address' => 'raval_himanshu@live.in', 'name' => 'Himanshu Raval'],

关于php - 无法在 laravel 5.2 中发送没有发件人地址的消息 我已经设置了 .env 和 mail.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34873613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com