Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何设置laravel配置以使用mailgun_Laravel_Email_Mailgun - Fatal编程技术网

如何设置laravel配置以使用mailgun

如何设置laravel配置以使用mailgun,laravel,email,mailgun,Laravel,Email,Mailgun,我正在使用Laravel 8+队列+Mailgun API从本地机器发送电子邮件 我不能发电子邮件。我有一个错误: [2020-12-19 11:50:26] local.ERROR: Connection could not be established with host smtp.mailgun.org :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F

我正在使用Laravel 8+队列+Mailgun API从本地机器发送电子邮件

我不能发电子邮件。我有一个错误:

[2020-12-19 11:50:26] local.ERROR: Connection could not be established with host smtp.mailgun.org :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:ssl3_get_record:wrong version number {"exception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host smtp.mailgun.org :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:ssl3_get_record:wrong version number at C:\\Users\\Dominique\\Documents\\Workspace\\market-gardener\\market-gardener-back\\vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\StreamBuffer.php:269)
[stacktrace]
我想我在某个地方遇到了配置问题。我做了很多事情都没有成功。我的确认:

.env:

MAIL_PORT=2525
MAILGUN_ENDPOINT=api.mailgun.net
MAILGUN_DOMAIN=sandbox___xxxxx_____________.mailgun.org
MAILGUN_SECRET=secret___xxxxxxxxxxxxxxxxx______
MAIL_ENCRYPTION=ssl 
配置/电子邮件:

'mailers' => [
        'smtp' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
            'port' => env('MAIL_PORT', 587),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'timeout' => null,
            'auth_mode' => null,
        ],

        'ses' => [
            'transport' => 'ses',
        ],

        'mailgun' => [
            'transport' => 'mailgun',
        ],

这种说法正确吗?我的错误在哪里?当然,我已经尝试清除缓存和配置。

以下是我使用的Mailgun设置的工作版本:

MAIL_HOST=smtp.eu.mailgun.org
MAIL_PORT=587
MAIL_FROM_ADDRESS=address@example.com
MAIL_FROM_NAME=example
MAIL_USERNAME=address@example.com
MAIL_PASSWORD="123abc456def"
MAIL_ENCRYPTION=tls
这些键耦合到默认的
config/mail.php
文件,如下所示:


注意
tls
和端口号
587
的用法。
邮件主机也可能不同。Mailgun可能在其网站上有一个页面,其中列出了此配置。

在.env()中缺少一个参数

我只在.env中添加了MAIL\u MAILER=mailgun,现在效果很好

My.env现在是:

MAIL_MAILER=mailgun
MAIL_PORT=2525
MAILGUN_ENDPOINT=api.mailgun.net
MAILGUN_DOMAIN=sandbox___xxxxx_____________.mailgun.org
MAILGUN_SECRET=secret___xxxxxxxxxxxxxxxxx______
MAIL_ENCRYPTION=ssl