致命错误:使用mailgun发送邮件时,未捕获的异常'RuntimeException',消息'Puli Factory不可用'

I'm trying to send mail using the following code and I'm using guzzlehttp, but getting Fatal error: Uncaught exception 'RuntimeException' with the message 'Puli Factory is not available'. Please help me find a solution, thanks!

Here is my code:

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'));

and i've replaced key and domain with my original.

I had the same problem.

Try:

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

Then:

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

Hope it help you.