use strict;
use LWP::UserAgent;
use HTTP::Request::Common;

my $uri = 'http://api.sendcloud.net/apiv2/mail/send';

my $ua = LWP::UserAgent->new;
# See http://search.cpan.org/~gaas/HTTP-Message-6.06/lib/HTTP/Request.pm
my $request = POST $uri,
    Content => [
        apiUser => '...', # Verification using api_user and api_key
        apiKey => '...'
        from => 'sendcloud@sendcloud.org', # The sender, use the correct email address instead
        fromName => 'SendCloud',
        to => 'test@ifaxin.com', # The recipient address,use the correct email address instead, multiple addresses with '; 'delimited
        subject => 'SendCloud perl webapi common example',
        html => '欢迎使用SendCloud',
        respEmailId => 'true'
    ];

my $response = $ua->request($request) ;
if ($response->is_success()) {
    print $response->content, "\n";
} else {
    print $response->as_string, "\n";
}

exit;
