NAME

Mail::IMAP2SMS - Perl extension for IMAP to SMS.

SYNOPSIS

# Import Module
use Mail::IMAP2SMS;

# Instantiate the IMAP2SMS object.
my $sms = Mail::IMAP2SMS->new('imap.example.com', 'test@example.com', 'p4$$w0rd', 1);

# Get unseen mail from inbox.
my $unseen = $sms->get_unseen('INBOX');

# Chunk each message into specified size (160) SMSs.
foreach (@$unseen) {
    my ($id) = $_;
    $sms->chunk($id, 160);
} # foreach

# Send chunked messages.
if ($sms->send('7895551234@vtext.com')) {
    print 'All sent successfully';
} else {
    print 'Send failed...';
} # if/else

# Close connection
$sms->disconnect;

DESCRIPTION

This module is a quick and easy way to SMS your IMAP email.

OBJECT CREATION METHOD

new
my $sms = Mail::IMAP2SMS->new( $server [ :port ], $username, $password, $ssl );

This class method constructs a Mail::IMAP2SMS object. It takes four required parameters. The server parameter may specify just the

server, or both the server and the port. To specify an alternate port, seperate it from the server with a colon (:), example.com:9876.

The ssl (BOOLEAN) parameter may specify whether to use or not use SSL to connect to the specified IMAP server.

METHODS

get_seen
my $seen = $sms->get_seen('INBOX');

This method takes one required parameter, an IMAP folder. The number of seen messages is returned on success. On failure, nothing is returned.

get_unseen
my $unseen = $sms->get_unseen('INBOX');

This method takes one required parameter, an IMAP folder. The number of seen messages is returned on success. On failure, nothing is returned.

chunk
print 'Successfully chunked!' if $sms->chunk($id, 160);

This method takes two require parameters, a message ID and a chunking size. The message ID is used to get the message from the IMAP server. Upon getting the message it is determined whether the subject and body can fit in one SMS or if the message must be broken into segments of the proper SMS size. Carriers differ on SMS size thus a size must be specified. On success, boolean true is returned. On failure, nothing is returned.

send
print 'Send successful...' if $sms->send('7895551234@vtext.com');

This method requires one parameter, a wireless carrier phone number email address. This method will send all SMS created to the specified email address. If more than three SMS are readied to send, a sending sleep time between each SMS will be applied to reduce the chance of the wireless carrier dropping any messages. On success, a boolean true is returned. On failure, nothing is returned.

disconnect
print 'Disconnected from IMAP...' if $sms->quit;

This method requires no parameters. It simply closes the connection to the IMAP server. On success, a boolean true is returned. On failure, nothing is returned.

AUTHOR

Roy Crowder, <roy.crowder@gmail.com>.

SEE ALSO

Net::IMAP::Simple, Net::IMAP::Simple::SSL, Email::Simple, Mail::Sendmail, perl, Changes

COPYRIGHT

Copyright (c) 2009 Roy Crowder.

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