Open kinglozzer opened 7 years ago
Any idea when this will be available?
@ARNHOE When what will be available? Version 3.0.0
of this module uses mailgun-php: 2.x
, the deprecated APIs don’t need to be updated for it to work 😃
@kinglozzer Couldnt get dev-master work, but 2.x works perfectly. Found out after the comment
Does this work for local development? This is the error message I get:
Debug (line 140 of Mailer.php): Mailgun error: An HTTP Error has occurred! Check your network connection and try again.
It does work locally, can you check which version of this module you’re using and paste your mailgun config?
Version installed is the latest I think. The configuration is as per this
Kinglozzer\SilverStripeMailgunner\Mailer: api_endpoint: 'http://bin.mailgun.net/C6f04a3a' debug: true
composer show
will show you which version you have installed. That all looks correct, it’s very similar to the configuration I used for when working on the module. I simply skipped the environment conditions:
---
Name: mailgun
After: 'silverstripe-mailgun'
---
Kinglozzer\SilverStripeMailgunner\Mailer:
api_domain: 'https://api.mailgun.net/v3/sandbox123456789987654321.mailgun.org'
api_endpoint: 'http://bin.mailgun.net/12345abcde'
api_key: 'key-1234564789876543212345678987654321'
debug: true
kinglozzer/silverstripe-mailgunner 3.1.0 as per composer show
.
Using mail gun directly works just fine (example below), using the class doesn't.
# Instantiate the client.
$mgClient = new Mailgun('my_key');
$domain = "sandbox123456789987654321.mailgun.org";
# Make the call to the client.
$result = $mgClient->sendMessage("$domain",
array('from' => 'Mailgun Sandbox <postmaster@ sandbox123456789987654321.mailgun.org>',
'to' => 'Ronaldo <myemail@hotmail.com>',
'subject' => 'Hello Ronaldo',
'html' => '<h1>Congratulations Ronaldo Santana</h1><p>You just sent an email with Mailgun! You are truly awesome!</p> '));
I just tried again using the same config and my own credentials and couldn’t recreate this. Could you add the following to the catch (Exception $e)
block here and see what the error is in more detail?
if ($e instanceof \Mailgun\Connection\Exceptions\GenericHTTPError) {
var_dump($e->getHttpResponseBody());
die;
}
The postbins do expire after a while, so it may be worth checking that too.
HttpClientConfigurator
to build the mailer, so sandbox mode is still possible~setApiVersion()
andsetSslEnabled()
~BatchMessage()
withnew Mailgun\Messages\BatchMessage
MessageBuilder()
withnew Mailgun\Messages\MessageBuilder
sendMessage()
withmessage()
BatchMessage()
andMessageBuilder()
currently still use legacy APIs of their own internally, so they will have to wait to be updated...