Mahmoud A. Mehyar


Net::Postage::App - Perl extension for API


    use Net::Postage::App;  
    my $postage = Net::Postage::App->new(api_key => 'YOUR_PostageApp_API_KEY_HERE');
    ## first - prepare your message
        from => 'your_name <your_email>',
        subject => 'Hi This is a test message',
        textmessage => 'Hi there this is a TEXT message test',
        htmlmessage => '<b>Hi there this is an HTML message test</b>',
        reply_to => '',
        headers => {
            'x-mailer' => ''
    ## second - add recipients
    ## You can add a single recipient
    ## You can add an array of recipients at once
    ## Or hash of recipients for variable replacement
        '' => { first_name => 'Mahmoud', ... },
        '' => { first_name => 'fName', ... }
    ## Last, do the send
    ## make sure the sending was suucessful
    ## otherwise send again later
    if (!$postage->is_success){
        print $postage->errorMessage . "\n";
    } else {
        print "Your message sent successfully";


Perl interface to the API "From their website" Outsource the sending of your application generated email, so your app can do what it does best... be awesome!




    my $postageapp = Net::Postage::App->new( api_key => 'YOUR API KEY' )


Create a new message to be sebt later

        from => 'Joe <>',
        subject => '...',
        textmessage => '...'

message method accepts the following arguments

from => 'name <emailAddress>'

Required : your from name and email address

subject => 'some text for subject'

Required : your message subject line

textmessage => 'text version of your email'

Optional if htmlmessage available

htmlmessage => 'html version of your message'

Optional if textmessage available, you can provide both fields

reply_to => 'reply_to email address'

Optional : reply to email field

attachments => ['/path/to/your/attachment.pdf']

arrayref of files you want to send as an attachment

resend => 1

Optional : When sending a message, a unique hash will be created to prevent resending the same message again, set this to 1 if you want to send the same identical message to same recipients

template => 'Template name'

Optional : name of the template you set at your postageapp dashboard if you set this then there is no need for other headers

variables => { var1 => 'default text', .. }

Optional : hashref of default variables to be used when recipients info is missing

headers => { 'x-sender' => '...' }

Optional : hashref of extra headers to include in your email


Where to send your email

to method accepts one of the following


a single email address

    $postageapp->to('email address');

an arrayref of multi recipients


hashref of multi recipients with customization fields

        'email1' => {
            'name' => 'Joe',
            'age' => 32,
        'email2' => {
            'name' => '',

to use these fields in your email you need to compose a text/html message in message method by wrapping a word in doubled curly braces like {{name}} and {{age}}


send your email



returns true if the send process was successful

    if ( $postageapp->is_success ) {  }


returns error message if the send process failed



None by default.


For more information about postageapp API please visit their documentation page


Mahmoud A Mehyar, <<gt>


Copyright (C) 2010-2013 by Mahmoud A. Mehyar

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.