在本地用gmail发送邮件laravel5

时间:2015-05-29 13:42:40

标签: email laravel gmail

发送电子邮件时遇到问题

我在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}  

有人可以帮我看错吗?

1 个答案:

答案 0 :(得分:0)

您在mail.php和.env中使用不同的端口