Home Forums WordPress Plugins Mailgun Bulk Mailer Error

Viewing 4 reply threads
  • Author
    Posts
    • #29820
      vinny
      Keymaster

      Hi MM,

      Thanks for reaching out. The logs show that messages were sent successfully on 22/02/2023 04:23:48, but then started failing due to an error from Mailgun. I’ll look into the code as to why the error message is not showing, but this indicates that you should contact Mailgun support to see why they’re blocking the send.

      Cheers,
      Vinny

    • #29868
      MM
      Participant

      This did not fix yet.

      From Mailgun support

      Your account is currently active so if you need help with sending with the API, here is some information that should help you in sending:
      
      https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api
      
      Sending a plain text message:
      
      curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from='Excited User <mailgun@YOUR_DOMAIN_NAME>' \ -F to=YOU@YOUR_DOMAIN_NAME \ -F [email protected] \ -F subject='Hello' \ -F text='Testing some Mailgun awesomeness!'

      Please advise.

    • #29869
      MM
      Participant

      To confirm. I have tested the API as they have suggested and it works well.

      [code]
      add_shortcode( ‘test_mailgun_api’, function(){
      $apiKey = ‘f51eXXXXXXXXXXXXXXXXXXXX-d1a07e51-b785537c’;
      $domain = ‘mg.domain.org’;
      $from = ‘Excited User <[email protected]>’;
      $to = ‘[email protected]’;
      $to2 = ‘[email protected]’;
      $subject = ‘Hello’;
      $text = ‘Testing some Mailgun awesomeness!’;

      $url = “https://api.mailgun.net/v3/$domain/messages&#8221;;

      $ch = curl_init();

      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($ch, CURLOPT_USERPWD, ‘api:’ . $apiKey);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, [
      ‘from’ => $from,
      ‘to’ => $to,
      ‘to’ => $to2,
      ‘subject’ => $subject,
      ‘text’ => $text,
      ]);

      $result = curl_exec($ch);
      ob_start();
      if (curl_errno($ch)) {
      echo ‘Error:’ . curl_error($ch);
      } else {
      echo ‘Mail sent successfully’;
      }

      curl_close($ch);
      return ob_get_clean();
      });
      [/code]

    • #29872
      vinny
      Keymaster

      Hi MM,

      That response from support is not helpful. Please check the Mailgun logs the next time it fails for relevant information about the failures.

    • #29876
      MM
      Participant

      That’s the problem. I don’t see any error details on the log. It just shows “Mailgun returned an error: ” plus there’s nothing shown in log at Mailgun dashboard.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.