Net::SMS::Mtnsms - a module to send SMS messages using the Mtnsms web2sms gateway (http://www.mtnsms.com/).
my $sms = Net::SMS::Mtnsms->new( autotruncate => 1, username => 'yourname', password => 'yourpassword', recipient => 07713123456, signature => 'a test', message => 'a test message', ); $sms->verbose( 1 ); $sms->message( 'a different message' ); print "sending message to mobile number ", $sms->recipient(); $sms->send_sms();
A perl module to send SMS messages, using the Mtnsms web2sms gateway. This module will only work with mobile phone numbers that have been registered with Mtnsms (http://www.mtnsms/) and uses form submission to a URL that may be subject to change.
There is a maximum length for SMS signature + message (160 for Mtnsms). If the sum of signature and message lengths exceed this, the behaviour of the Net::SMS::Mtnsms objects depends on the value of the 'autotruncate' argument to the constructor. If this is a true value, then the signature / message will be truncated to 123 characters. If false, the object will throw an exception (croak).
The constructor for Net::SMS::Mtnsms takes the following arguments as hash values (see "SYNOPSIS"):
Mtnsms has a upper limit on the length of the subject + message (123). If autotruncate is true, subject and message are truncated to 123 if the sum of their lengths exceeds 160. The heuristic for this is simply to treat subject and message as a string and truncate it (i.e. if length(subject) >= 123 then message is truncated to 0. Thanks to Mark Zealey <firstname.lastname@example.org> for this suggestion. The default for this is false.
The Mtnsms username for the user (assuming that the user is already registered at http://www.mtnsms.com/.
The Mtnsms password for the user (assuming that the user is already registered at http://www.mtnsms.com/.
Mobile number for the intended SMS recipient.
SMS message subject.
SMS message body.
If true, various soothing messages are sent to STDERR. Defaults to false.
All of the constructor arguments can be got / set using accessor methods. E.g.:
$old_message = $self->message; $self->message( $new_message );
This method is invoked to actually send the SMS message that corresponds to the constructor arguments.
Many thanks to P-A-N-D-O-R [email@example.com] for access to a script he wrote for submitting SMS messages via mtnsms.
Ave Wrigley <Ave.Wrigley@itn.co.uk>
Copyright (c) 2001 Ave Wrigley. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.