我无法使用 Laravel 通过 mailgun 发送邮件

I'm not able to send mail via mailgun using Laravel

我在发送电子邮件时遇到了问题。我的网站是用 Laravel 构建的。我已正确设置文件。这发生在 2 个文件中。

第一个包含 "driver" 当然是 mailgun,"host" (smtp.mailgun.org),"port"(587,根据我的供应商,它已打开),"encryption" (tls)、"username" 和 "password"(均具有正确的值)。

第二个包含 "domain" 和 "secret"(也都具有正确的值)。

该域名不是mailgun域名而是我自己的域名,在设置了域名验证和DNS之后是ACTIVE的

mailgun 域仍然有效。我不知道我是否必须删除它或其他东西。我真的不知道我在这里错过了什么。


重要更新

Class 'GuzzleHttp\Client' not found

我收到了这条消息


mail.php

return array(

    'driver' => 'mailgun',

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

    'port' => 587,

    'from' => array('address' => 'not-reply@xxxxxxxxx.com', 'name' => 'xxxxxxx'),

    'encryption' => 'tls',

    'username' => "xxxxxxxxxxxxxx",

    'password' => "xxxxxxxxxxxxxx",

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

    'pretend' => false,

);

很明显,xxxxxxxxxx 是我的个人数据。我可以保证我正在设置正确的值。它确实应该工作。 :(

services.php

return array(

    'mailgun' => array(
        'domain' => 'domain-here',
        'secret' => 'key-here',
    ),

    'mandrill' => array(
        'secret' => '',
    ),

    'stripe' => array(
        'model'  => 'User',
        'secret' => '',
    ),

);

domainsecret 也填充了正确的值。

尝试直接要求 guzzle 依赖项。

  1. "guzzle/guzzle": "~3.9@dev" 添加到 composer.json,例如:

    "require": {
        "laravel/framework": "5.0.*",
        "guzzle/guzzle": "~4.0"
    },
    
  2. 更新您的项目。下面的命令应该在 terminal/console 中执行。例如,如果您的 laravel 应用程序托管在 windows 机器上,您可以:

    > cd project/folder/path // change the working path
    > composer update // this command update the proyect and dependencies
    

    如果您 laravel 托管在 linux 机器上,您会:

    $ cd /path/a/mi/folder   // change the working path
    $ composer update   // this command update the proyect and dependencies
    
  3. 再次测试您的应用程序

@manix 的建议似乎是正确的方法,但建议 3.9 的版本已弃用。所以应该是:

"guzzlehttp/guzzle": "~4.0"

因为我用 Laravel 4.2.

构建了项目

对于Laravel 5.0应该是5.0