Mailgun Laravel 发送电子邮件错误 客户端错误消息

2024-01-03

在 Laravel 5.1 上设置 mailgun 后,我确实收到错误消息:

客户端错误响应 [url]https://api.mailgun.net/v3//messages.mime https://api.mailgun.net/v3//messages.mime[状态代码] 404 [原因短语] 未找到

我在 mailgun 上创建了一个帐户。

编辑config/services.php

咕咕已安装

编辑 .env(mail_driver、mail_from、mail_nam、mailgun_domain 和 mailgun_secret)

我将 DNS 记录检查到 mailgun 仪表板并进行了验证。

有什么修复可以开始使用 laravel 和 mailgun 发送电子邮件吗?


造成这种情况的主要原因是环境变量配置错误。更新您的 config/mail.php 文件。替换变量值env('varname', 'value') to 'value'.

这是一个例子(为我工作!):

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Mail Driver
    |--------------------------------------------------------------------------
    |
        | Laravel supports both SMTP and PHP's "mail" function as drivers for the
    | sending of e-mail. You may specify which one you're using throughout
    | your application here. By default, Laravel is setup for SMTP mail.
    |
    | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
    |
    */

    'driver' => 'mailgun',

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Address
    |--------------------------------------------------------------------------
    |
    | Here you may provide the host address of the SMTP server used by your
    | applications. A default option is provided that is compatible with
    | the Mailgun mail service which will provide reliable deliveries.
    |
    */

    'host' => 'smtp.mailgun.org',

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Port
    |--------------------------------------------------------------------------
    |
    | This is the SMTP port used by your application to deliver e-mails to
    | users of the application. Like the host we have set this value to
    | stay compatible with the Mailgun e-mail application by default.
    |
    */

    'port' => 587,

    /*
    |--------------------------------------------------------------------------
    | Global "From" Address
    |--------------------------------------------------------------------------
    |
    | You may wish for all e-mails sent by your application to be sent from
    | the same address. Here, you may specify a name and address that is
    | used globally for all e-mails that are sent by your application.
    |
    */

    'from' => ['address' => '[email protected] /cdn-cgi/l/email-protection', 'name' => 'AppName'],

    /*
    |--------------------------------------------------------------------------
    | 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' => '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' => null,

    /*
    |--------------------------------------------------------------------------
    | SMTP Server Password
    |--------------------------------------------------------------------------
    |
    | Here you may set the password required by your SMTP server to send out
    | messages from your application. This will be given to the server on
    | connection so that the application will be able to send messages.
    |
    */

    'password' => null,

    /*
    |--------------------------------------------------------------------------
    | Sendmail System Path
    |--------------------------------------------------------------------------
    |
    | When using the "sendmail" driver to send e-mails, we will need to know
    | the path to where Sendmail lives on this server. A default path has
    | been provided here, which will work well on most of your systems.
    |
    */

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

    /*
    |--------------------------------------------------------------------------
    | Mail "Pretend"
    |--------------------------------------------------------------------------
    |
    | When this option is enabled, e-mail will not actually be sent over the
    | web and will instead be written to your application's logs files so
    | you may inspect the message. This is great for local development.
    |
    */

    'pretend' => false,
];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Mailgun Laravel 发送电子邮件错误 客户端错误消息 的相关文章

随机推荐

  • 如何使用盆地跳跃写入参数范围?

    我很难在其中写入参数的界限basinhopping x0 a b c a 0 100 b 0 0 100 c 0 10 from scipy optimize import basinhopping minimizer kwargs met
  • 使用 clang 内置函数与标准函数的优点

    Clang 和 GCC 定义了一堆内置函数 我将在这里使用余数的示例 builtin sqrt x 然而 标准 C99 定义了以下内容math h sqrt x clang 为已经存在的方法定义内置函数有什么意义 我本以为常见的数学函数 例
  • 使用函子派生类函数的广义新类型

    我正在开发一个表示键 值映射的类 并且我有一个基本上类似于alterF https hackage haskell org package containers 0 5 11 0 docs Data Map Strict html v al
  • 小数或空白的正则表达式

    很抱歉这个可能很愚蠢的问题 但我正在尝试整理一个正则表达式 该表达式允许 小数点前有 1 或 2 个数字 小数点后有 0 6 个数字 但是 如果需要的话 我还需要允许该字段为空 有效示例 0 952321 1 20394 12 12 25
  • 如何使用 start 在 alpine docker 容器中加载 shell 别名

    我编写了一个 DOCKER 文件 它使用私有改编的 alpine 图像作为图像 其中包含 nginx 服务器 注意 alpine 使用 zsh 而不是 bash 当我在容器中工作时 我喜欢有一些可用的 shell 别名 当它们丢失时 它会让
  • 如何避免偶尔损坏的下载

    我的网站托管一个用户需要下载的 msi 文件 该文件没有什么特别的 它位于网络服务器上的一个目录中 并有一个指向它的常规 HREF 用户可以单击该目录 有时 用户会抱怨他们无法打开 msi 文件 因为 Windows Installer 声
  • 错误:26 - 定位指定的服务器/实例时出错。 (无法从我的主机服务器连接到我的本地数据库)

    我之前已经问过这个问题了 但是没有很好的答复 我的问题是我的 app data 文件夹中有一个本地数据库 aspnetdb mdf 这里是 web config 中的连接字符串
  • 无法修改我的脚本来限制抓取时的请求数量

    我用 python 编写了一个脚本Thread同时处理多个请求并更快地进行抓取过程 该脚本正在相应地完成其工作 简而言之 抓取工具的作用是 它解析从登陆页面通向其主页 存储信息的位置 的所有链接并抓取happy hours and feat
  • org.hibernate.exception.ConstraintViolationException:无法执行语句

    所以情况是这样的 我正在使用 struts2 和 hibernate 创建一个 web 应用程序 我正在创建一个更改密码页面 用户可以通过该页面更改其密码 但我收到错误为 org hibernate exception Constraint
  • 从 Linux 命令行为视频添加水印

    有谁知道如何使用简单的工具从 Linux 命令行为视频添加水印 当前版本不支持 ffmpeg 中的水印 需要自定义编译 Max ffmpeg y i inputFile mpg vhook usr lib vhook watermark s
  • 点选择器 event_handler 在 matplotlib 中绘制线并显示坐标

    我有下面的类 它通过 y 轴绘制一条垂直线 这样当我单击它时 就会在该位置绘制一条水平线 我的目标是让 y 坐标实际打印在绘制水平线的 y 轴上 为了进行测试 我尝试使用 y 坐标打印标题 但它没有按预期工作 我真正想要完成的是使条形图上的
  • 循环遍历 $_POST 变量

    抱歉 我找不到这个问题的合适标题 我使用 for 循环生成了以下内容 并使用以下模式连接了提交按钮的名称 提交 编辑 类别 1 提交 编辑 类别 2 提交 编辑 类别 3 echo
  • 在 Python 中从设备名称映射到挂载点的可靠且“尽可能便携”的方式

    我希望能够获取设备名称 例如 dev disk2 并确定其安装位置 如果有 例如 mnt cdrom or Volumes RANDLABEL 在Python中 我可以做到这一点的一种方法是运行df or mount然后解析输出 但这看起来
  • 如何在 JavaScript 中模拟按键? [复制]

    这个问题在这里已经有答案了 我正在尝试找到一种模拟按键的方法 例如 当功能启动时 应按下 向下箭头 键 因此网页应稍微滚动 我只对 Chrome 感兴趣 jQuery 或纯 JS 都合适 纯 JS 会更可取 这是我尝试过的代码示例之一 va
  • 使用 find 排除子目录

    我有这样的目录结构 data abc incoming def incoming processed 123 incoming 456 incoming processed Data 目录内的所有文件夹中都有一个传入子文件夹 我想获取除 d
  • 将作品放入 Postman 但不放入 AXIOS

    这是我的 MERN 应用程序中最奇怪的事情 当我从 Postman 向我的 api 执行 PUT 时 它会工作并更新我的 api 和 mongoDB 在前端 即使控制台日志显示正确的值并且 url 相同 它也不会更新 api 任何帮助或指导
  • 是否有固定大小分配器的优雅 C++ 实现?

    我认为如果必须包含的头文件数量尽可能少 C 库就是 优雅的 我知道已经存在固定大小的分配器 例如Loki SmallObjectAllocator and boost pool 虽然两者都很优秀 但我认为它们不够优雅 也不容易无缝集成到项目
  • 我应该如何使用 pandas 处理时间序列数据中的重复时间?

    我从 API 调用返回以下内容作为更大数据集的一部分 时间 datetime datetime 2017 5 21 18 18 1 tzinfo tzutc 价格 0 052600 时间 datetime datetime 2017 5 2
  • T-SQL 如何匹配多行

    有两个表 包装表和产品表 就我而言 包装中包含多种产品 我们需要识别多个产品是否可以与包裹记录中已有的包裹匹配 一些脚本如下 DECLARE tblPackage TABLE PackageID int ProductID int INSE
  • Mailgun Laravel 发送电子邮件错误 客户端错误消息

    在 Laravel 5 1 上设置 mailgun 后 我确实收到错误消息 客户端错误响应 url https api mailgun net v3 messages mime https api mailgun net v3 messag