The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Net::SMS::Mach - Send SMS messages via the Mach HTTP API

VERSION

version 0.02

SYNOPSIS

# Create a testing sender
my $sms = Net::SMS::Mach->new(
userid => '123456', password => 'testpass'
);
# Send a message
my ($sent, $status) = $sms->send_sms(
message => "All your base are belong to us",
number => '1234567890',
sender => '+441234567890',
);
$sent will contain a true / false if the sending worked,
$status will contain the status message from the provider.
# If you just want a true / false if it workes, use :
my $sent = $sms->send_sms(
message => "All your base are belong to us",
number => '1234567890',
);
# If your message is utf8 encoded, or you are unsure if it's iso-8859-1,
# use the encode flag to get the message UCS encoded.
my ($sent, $status, $desc) = $sms->send_sms(
message => "All your base are belong to us",
number => '1234567890',
encode => 1,
);
if ($sent) {
# Success, message sent
}
else {
# Something failed
warn("Failed : $status");
}

DESCRIPTION

Perl module to send SMS messages through the HTTP API provided by Mach (mach.com).

METHODS

new

new( userid => '123456', password => 'testpass' )

Nothing fancy. You need to supply your username and password in the constructor, or it will complain loudly.

send_sms

send_sms(number => $phone_number, message => $message, encode => 0, backup_server => 1)

Uses the API to send a message given in $message to the phone number given in $phone_number.

Phone number should be given with only digits, or with a "+" prefix.

1234567890

Returns a true / false value and a status message. The message is "success" if the server has accepted your query. This does not mean that the message has been delivered.

SEE ALSO

Mach website, http://www.mach.com/

AUTHOR

Terje Kristensen <terjek@opera.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Opera Software ASA.

This is free software, licensed under:

The (three-clause) BSD License