【问题标题】:Send mails laravel5 with gmail in local在本地使用 gmail 发送邮件 laravel5
【发布时间】: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 帐户。
  • 是的,我在面板中激活了此选项,但我遇到了同样的问题。

标签: email laravel gmail


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-02-12
    • 2017-02-20
    • 2015-05-29
    • 1970-01-01
    • 2011-11-24
    • 1970-01-01
    • 2013-07-13
    • 1970-01-01
    • 2011-02-16
    相关资源
    最近更新 更多