Nik*_*iya 5 php guzzle mailgun
我正在尝试使用以下代码发送邮件,我正在使用guzzlehttp,但是收到Fatal error: Uncaught exception 'RuntimeException'消息'Puli Factory is not available'.请帮我找一个解决方案,谢谢!
这是我的代码:
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'));
Run Code Online (Sandbox Code Playgroud)
并且我用原始文件替换了密钥和域名.
我有同样的问题.
尝试:
$client = new \Http\Adapter\Guzzle6\Client();
$mailgun = new \Mailgun\Mailgun('api_key', $client);
Run Code Online (Sandbox Code Playgroud)
然后:
$mailgun->sendMessage(.....)
Run Code Online (Sandbox Code Playgroud)
希望它对你有所帮助.