Menno Blom
and 1 contributors

NAME

Net::SMS::Mollie - Send SMS messages via the mollie.nl service

SYNOPSIS

  use strict;
  use Net::SMS::Mollie;

  my $mollie = new Net::SMS::Mollie;
     $mollie->login('username', 'p4ssw0rd');
     $mollie->recipient('0612345678');
     $mollie->send("I can send SMS!");

  if($mollie->is_success) {
     print "Successfully sent message to ".$mollie->successcount." number(s)!";
  } else {
     print "Something went horribly wrong!\n".
           "Error: ".$mollie->resultmessage." (".$mollie->resultcode.")";
  }

or, if you like one liners:

  perl -MNet::SMS::Mollie -e 'send_sms("username", "password", "recipient", "text", "originator")'

DESCRIPTION

Net::SMS::Mollie allows sending SMS messages via http://www.mollie.nl/

METHODS

new

new creates a new Net::SMS::Mollie object.

options

baseurl

Defaults to https://secure.mollie.nl/xml/sms/, but could be set to, for example, the non SSL URL http://www.mollie.nl/xml/sms/.

ua

Configure your own LWP::UserAgent object, or use our default one.

gateway

Defaults to gateway "1". For more information on the mollie.nl gateways, please read http://www.mollie.nl/docs/help/?id=1

originator

The sender of the SMS. Could be 14 digits or 11 characters. Defaults to "Mollie", so you most likely do want to override this default.

username

Your mollie.nl username

password

Your mollie.nl password

recipients

Takes an array of phonenumbers to send the message to.

message

The actual SMS text

type

Defaults to normaal, but could be set to normaal, wappush, vcard, flash, binary, or long

deliverydate

optional When do you want to send the SMS? Format: yyyymmddhhmmss

url

optional Only useful for the wappush type. Specify the URL of the wappush content.

udh

optional Only useful for the binary type. Specify the header of the SMS message.

All these options can be set at creation time, or be set later, like this:

  $mollie->username('my_username');
  $mollie->password('my_password');
  $mollie->type('wappush');
  $mollie->url('some_url');

Without an argument, the method will return its current value:

  my $username = $mollie->username;
  my $baseurl  = $mollie->baseurl;

login

Set the username and password in one go.

  $mollie->login('my_username', 'my_p4ssw0rd');

  # is basically a shortcut for

  $mollie->username('my_username');
  $mollie->password('my_p4ssw0rd');

Without arguments, it will return the array containing username, and password.

   my ($user, $pass) = $mollie->login;

recipient

Push numbers in the recipients array

  foreach(qw/1234567890 0987654321 1292054283/) {
     $mollie->recipient($_);
  }

send

Send the actual message. If this method is called with an argument, it's considered the message. Returns true if the sending was successful, and false when the sending failed (see resultcode and resultmessage).

is_success

Returns true when the last sending was successful and false when it failed.

successcount

Returns the amount of messages actually sent (could be useful with multiple recipients).

resultcode

Returns the resulting code, as provided by mollie.nl. See http://www.mollie.nl/geavanceerd/sms/http/ for all possible codes.

When LWP::UserAgent reports an error, the resultcode will be set to -1.

resultmessage

Returns the result message, as provided by mollie.nl, or LWP::UserAgent.

credits

Requires both username and password to be set, and returns the amount of remaining credits (with 4 decimals) or undef:

  if(my $credits = $mollie->credits) {
     print $credits." credits left!\n";
  } else {
     print $mollie->resultmessage." (".
           $mollie->resultcode.")\n";
  }

SEE ALSO

BUGS

Please report any bugs to http://rt.cpan.org/Ticket/Create.html?Queue=Net-SMS-Mollie

AUTHOR

M. Blom, <blom@cpan.org>, http://menno.b10m.net/perl/

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.