Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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      <[email protected]>',
                    'to'      => 'John Doe<[email protected]>',
                    'subject' => 'Hello John Doe',
                    'text'    => 'Email Text'));

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

like image 495
Nikhil Radadiya Avatar asked Apr 06 '16 06:04

Nikhil Radadiya


1 Answers

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.

like image 194
dorondo Avatar answered Oct 27 '22 09:10

dorondo