【发布时间】:2015-05-29 13:42:40
【问题描述】:
我在发送电子邮件时遇到问题
我在 Laravel 中有以下代码
文件mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('smtp.gmail.com'),
'port' => env('MAIL_PORT', 465),
'from' => ['address' => 'email@gmail.com', 'name' => 'Kiko'],
'encryption' => 'ssl',
'username' => env('email@gmail.com'),
'password' => env(''),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
日志
[2015-05-29 13:27:48] local.DEBUG: Message-ID: <673a61b16f681371f9daa76f839527bd@localhost>
Date: Fri, 29 May 2015 13:27:48 +0000
Subject: Welcome to My Website
From: Kiko <email@gmail.com>
To: email@gmail.com
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
还有 .env
MAIL_DRIVER=log
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME='email@gmail.com'
MAIL_PASSWORD=''
如果在文件 .env 中我将 .log 更改为 smpt,则日志会返回此消息
Maximum execution time of 30 seconds exceeded
[2015-05-29 13:40:40] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum execution time of 30 seconds exceeded' in C:\xampp3\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php:53
Stack trace:
#0 {main}
谁能帮我看看错误?
【问题讨论】:
-
您是否在 Gmail 控制面板中启用了
Less secure apps?如果不这样做,您将无法通过 smtp 连接到您的 gmail 帐户。 -
是的,我在面板中激活了此选项,但我遇到了同样的问题。