With the same versions installed as Paul, the example from Mailgun API 
documentation (http://documentation.mailgun.com/api-sending.html#examples) 
works fine on my machine:

use Mojo::UserAgent;

my $MailgunAPI = 'api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0';
my $MailgunURL = 'api.mailgun.net/v2/samples.mailgun.org/messages';

my $ua  = Mojo::UserAgent->new;
my $url = "https://$MailgunAPI\@$MailgunURL";;

my $MailgunPost = {
  'from'    => 'Excited User <[email protected]>',
  'to'      => $my_mail_address,
  'subject' => 'Hello',
  'text'    => 'Testing some Mailgun awesomness!',
};

my $tx = $ua->post($url => form => $MailgunPost);

if ($tx->success) {
  say $tx->res->body;
} else {
  say $tx->error->{message};
}

Answer:

{
  "message": "Queued. Thank you.",
  "id": "<[email protected]>"
}



-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to