php - fatal error : Uncaught exception 'RuntimeException' with message 'Puli Factory is not available' while sending mail using mailgun

标签 php guzzle mailgun

我正在尝试使用以下代码发送邮件,我正在使用 guzzlehttp,但收到 Fatal error: Uncaught exception 'RuntimeException' 消息 '埔里工厂不可用'.请帮我找到解决方案,谢谢!

这是我的代码:

require 'vendor/autoload.php';
use Mailgun\Mailgun;

# Instantiate the client.
$mgClient = new Mailgun('key-');
$domain = "domain";

# Make the call to the client.
$result = $mgClient->sendMessage("$domain",
              array('from'    => 'Mailgun Sandbox      <xxxxxx@sandbox.mailgun.org>',
                    'to'      => 'John Doe<xxxxx@abc.com>',
                    'subject' => 'Hello John Doe',
                    'text'    => 'Email Text'));

并且我已经用原来的替换了 key 和域。

最佳答案

我遇到了同样的问题。

尝试:

$client = new \Http\Adapter\Guzzle6\Client(); 
$mailgun = new \Mailgun\Mailgun('api_key', $client);

然后:

$mailgun->sendMessage(.....)

希望对你有帮助。

关于php - fatal error : Uncaught exception 'RuntimeException' with message 'Puli Factory is not available' while sending mail using mailgun,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36443480/

相关文章:

php - 在 zend framework 2 中启用 BjyProfiler 模块

php - 是否可以通过 HTTP/2 设置 Guzzle + Pool?

php - curl 问题 : same request, 不同的响应

laravel - 使用 Mailgun、Laravel 和 VirtualBox 发送电子邮件时出现 "Server response: 451 451 Temporary local - please try later"

Php/MySql 建议

phpEXCEL getCalculatedValue 未返回所需结果

php - 是否可以全局记录所有 Guzzle 请求?

email - (Mailgun) 入站路由 catch_all() 不转发自动回复

php - 如何用 mailgun 发送 HTML 邮件?

php - foreach 循环获取元素的值