Being trying to use Mailgun on a tutorial.
I get this error and I am stuck…
This is on my localhost apache windows
Fatal error
Uncaught exception: ‘Http\Discovery\Exception\NotFoundException’
Message: ‘No PSR-17 url factory found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation’
Call to Mail Class
Mail::send('xxxx@gmail.com','Test','This is a test', '<h1>This is a test</h1>');
Mail Class
<?php
namespace App;
use App\Config;
use Mailgun\Mailgun;
/**
* Mail
*
* PHP version 7.0
*/
class Mail
{
/**
* Send a message
*
* @param string $to Recipient
* @param string $subject Subject
* @param string $text Text-only content of the message
* @param string $html HTML content of the message
*
* @return mixed
*/
public static function send($to, $subject, $text, $html)
{
$domain = "https://app.mailgun.com/app/sending/domains/sandboxa38feaf00c804083b97e97be976b62d5.mailgun.org";
# First, instantiate the SDK with your API credentials
$mg = Mailgun::create('XXX');
# Now, compose and send your message.
# $mg->messages()->send($domain, $params);
$mg->messages()->send($domain, [
'from' => 'Excited User <mailgun@$domain>',
'to' => $to,
'subject' => $subject,
'text' => $text
]);
}
}