NAME
FWS::V2::SocketLabs - FrameWork Sites version 2 socketlabs.com SMTP integration
VERSION
Version 0.02
SYNOPSIS
This module will process all outgoing mail from FWS 2.0 though a socketlabs.com SMTP account. Add the following to your FWS go.pl FWS parameter:
my $fws = FWS::V2->new( %yourConfiguration,
sendMethod => 'socketlabs');
Here is an example FWS independent process you can use as a starter to make your own customized FWS socketlabs process. This will be appropriate to be added to your CRONTAB to run 'socketLabs.pl send' every minute and run 'socketLabs.pl audit' every hour. This will work fine if your sending less than 500 email an hour. If you are sending more than that you should create a custom optimized script for your application based on what your trying to accomplish.
Crontab entry:
* * * * * /wherever/it/is/socketLabs.pl send >/dev/null 2>&1
0 * * * * /wherever/it/is/socketLabs.pl audit >/dev/null 2>&1
socketLabs.pl:
#!/usr/bin/perl
use strict;
#
# setup your FWS
#
use FWS::V2;
my $fws = FWS::V2->new(%yourConfiguration,
SocketLabs=>{ mailingId => 'unique', # up to 8 characters of unique string
port => '2525',
host => 'smtp.socketlabs.com',
username => 'user name for SMTP auth',
password => 'password for SMTP auth',
queueFailLimit => 5,
apiURL => 'https://api.socketlabs.com/v1',
apiAccountId => 'from socket labs account',
apiPassword => 'from socket labs account',
apiUsername => 'from socket labs account'}
);
#
# add SocketLabs
#
$fws->registerPlugin('FWS::V2::SocketLabs');
#
# Add your site values
#
$fws->setSiteValues('site');
#
# Usage String
#
my $usageString = "\nUsage: socketlabs.pl [send|audit]\n\n\tsend: send the current queue\n\taudit: sync the socketlabs data with FWS\n\n";
if ($#ARGV != 0) { print $usageString }
#
# we have an argument lets do it!
#
else {
my $arg = $ARGV[0];
my $email = $ARGV[1];
#
# send anything in the queue
#
if ($arg eq 'send') {
print "Runnning Process: ".$arg."\n\n";
$fws->SocketLabs_processQueue();
}
#
# audit anything that was sent and update FWS if there is something not synced
#
elsif ($arg eq 'audit') {
print "Runnning Process: ".$arg."\n\n";
my @historyArray = $fws->queueHistoryArray(synced=>'0');
if ($#historyArray > -1 ) { $fws->SocketLabs_processAudit() }
else { print "No sync required\n\n" }
}
}
1;
PLUGIN INITIALIZATION
pluginInit
Create a socketLabs object with the configuration parameters.
fws
Pass what FWS object you want it to use for its lookups
mailingId
Make sure this is Less than 8 characters. If you use your socketLabs account for more than one account make sure this is unique.
port
Port 2525 should be good. If not 25 would be another appropriate port.
host
Default is: smtp.socketlabs.com
username
This is the username for the SMTP auth.
password
This is the password for the SMTP auth.
queueFailLimit
How many times it will try to audit before it gives up on the sync. Make sure this is at least 5 is you are syncing every minute.
apiURL
Deault is: https://api.socketlabs.com/v1
apiAccountId
Consult the socketlabs API documentation to know what this is.
apiUsername
Consult the socketlabs API documentation to know what this is.
apiPassword
Consult the socketlabs API documentation to know what this is.
EXTENDED METHODS
SocketLabs_processQueue
Move through the FWS queue and send all email in the queue with the socketlabs type.
SocketLabs_processAudit
Audit all the socket labs success and fail messages and update FWS with the response.
AUTHOR
Nate Lewis, <nlewis at gnetworks.com>
BUGS
Please report any bugs or feature requests to bug-fws-v2-socketlabs at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FWS-V2-SocketLabs. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc FWS::V2::SocketLabs
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2012 Nate Lewis.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.