Mailgun plugin for eu region

I am trying to set the plugin to work, but it seems to fail. I tried to change in the source (HttpClientConfigurator.php and Mailgun.php) the instances of ‘https://api.mailgun.net’ to ‘https://api.eu.mailgun.net’ but with no success. I also set the sender as for using the active mailgun domain, and set the api key. Obviously, I first checked that my mailgun account is working, by sending a test email via the curl interface.

How can I proceed? There is some debug flag that I can use to deepen the analysis of what is going on?

Thank you in advance :slightly_smiling_face:

@AlessandroFalaschi Errors in sending should be written to the phplist event log.

The plugin needs updating with the latest SDK but this recent change shows how to set the endpoint

1 Like

Thank you very much Duncan,

I applied the patch you suggest, as well the little hack I mention, but unfortunately I still have no success, so I am using Mailgun via the SMTP interface, which works well.

The phplist event log simply state

Started [0.0194990000] (131)
Sending in batches of 180 emails [0.0001440000] (132)
Processing has started, [0.0004130000] (135)
One campaign to process. [0.0088970000] (137)
Processing campaign 34 [0.0094370000] (155)
Looking for subscribers [0.0383680000] (160)
Found them: 3 to process [0.0102820000] (166)
Processed 3 out of 3 subscribers [120.9992230000] (266)
Script stage: 5 [0.0062470000] (268)
3 failed (will retry later) [0.0001570000] (269)
1 Campaign
0 num_users_for_message
3 batch_count
180 batch_total
3 sendemail returned false total
0 send blocked by domain throttle
0 add attachment error
3 sendemail returned false
0 sentastest
0 invalid
3 failed_sent
0 Sent
180 num_per_batch
1 Status
0 sent_users_for_message 34
3 total_users_for_message 34
0 max_users_for_message 34
3 processed_users_for_message 34
3 failed_sent_for_message 34
Finished this run [0.0169530000] (326)

which seems to me of little use. Next days I could try to use the US region endopint to check if my problem manifests itself only for the EU region.

@AlessandroFalaschi This is the code in the plugin that sends an email

try {
    $result = $client->sendMessage($domain, $parameters, $files);
} catch (Exception $e) {
    logEvent(sprintf('Mailgun send exception: %s', $e->getMessage()));

    return false;
}

if ($result->http_response_code == 200 && $result->http_response_body->message == 'Queued. Thank you.') {
    return true;
}
logEvent('Mailgun send failed: ' . print_r($result, true));

return false;

If the plugin returns false, which seems to be what is happening, then there will be an entry in the event log.

1 Like

Oh well, I did not realize I had to check the event log under System/EventLog. I seems to be more informative than the messages on the console. At the moment my mailgun domain is blocked again, but I think I am on the good path.

Thank you again very much for the patience!

1 Like