The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


FWS::V2::SocketLabs - FrameWork Sites version 2 SMTP integration


Version 0.02


This module will process all outgoing mail from FWS 2.0 though a SMTP account. Add the following to your FWS 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 ' send' every minute and run ' 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/ send  >/dev/null 2>&1
        0 * * * * /wherever/it/is/ audit  >/dev/null 2>&1

        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            => '',
                                        username        => 'user name for SMTP auth',
                                        password        => 'password for SMTP auth',
                                        queueFailLimit  => 5,
                                        apiURL          => '',
                                        apiAccountId    => 'from socket labs account',
                                        apiPassword     => 'from socket labs account',
                                        apiUsername     => 'from socket labs account'}

        # add SocketLabs

        # Add your site values

        # Usage String
        my $usageString = "\nUsage: [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";

                # 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" }



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:

  • 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:

  • 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.



Move through the FWS queue and send all email in the queue with the socketlabs type.


Audit all the socket labs success and fail messages and update FWS with the response.


Nate Lewis, <nlewis at>


Please report any bugs or feature requests to bug-fws-v2-socketlabs at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc FWS::V2::SocketLabs

You can also look for information at:



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 for more information.