FWS-V2-SocketLabs
view release on metacpan or search on metacpan
lib/FWS/V2/SocketLabs.pm view on Meta::CPAN
# kill the guid so we make a new record and save it to the history
#
my %historyHash = %paramHash;
$historyHash{'queueGUID'} = $messageId;
$historyHash{'guid'} = '';
$self->saveQueueHistory(%historyHash);
#
# Remove this item from the Queue
#
$self->deleteQueue(%paramHash);
}
sub _SocketLabs_post {
my ($self,%paramHash) = @_;
# Connection
my $URL = $paramHash{'url'};
my $method = $paramHash{'method'};
# Authentication
my $account_id = $paramHash{'account_id'};
my $user = $paramHash{'user'};
my $password = $paramHash{'password'};
# Query Params
my $serverId = $paramHash{'serverId'};
my $startDate = $paramHash{'startDate'};
my $endDate = $paramHash{'endDate'};
my $timeZone = $paramHash{'timeZone'};
my $mailingId = $paramHash{'mailingId'};
my $messageId = $paramHash{'messageId'};
my $index = $paramHash{'index'};
my $count = $paramHash{'count'};
my $type = $paramHash{'type'};
#
# Failure codes
#
my %failCode = (
1001 => "Spam complaint",
1002 => "Blacklist",
1003 => "ISP block",
1004 => "Content block",
1005 => "URL block",
1006 => "Excess traffic",
1007 => "Security violation or virus",
1008 => "Open relay",
1009 => "Namespace mining detection",
1010 => "Authentication",
1999 => "Other",
2001 => "Unknown user",
2002 => "Bad domain",
2003 => "Address error",
2004 => "Closed account",
2999 => "Other",
3001 => "Recipient mailbox full",
3002 => "Recipient email account is inactive or disabled",
3003 => "Greylist",
3999 => "Other",
4001 => "Recipient server too busy",
4002 => "Recipient server returned a data format error",
4003 => "Network error",
4004 => "Recipient server rejected message as too old",
4006 => "Recipient network or configuration error normally a relay denied",
4999 => "Other",
5001 => "Auto Reply",
5999 => "Other",
9999 => "Unknown"
);
#
# Check for Important Variables
#
if ($account_id eq '') { warn("Your account number has not been set"); }
if ($user eq '') { warn("Your authentication Username has not been set"); }
if ($password eq '') { warn("Your authentication Password has not been set"); }
# Check if URL and method are set
if ($URL eq '') { $URL = "https://api.socketlabs.com/v1"; }
if ($method eq '') { $method = "messagesQueued"; }
#
# Trim Ending Backslash from URL and Method
# so we can handle it without worrying how
# it was passed to the sub routine
#
$URL =~ s/\/$//sg;
$method =~ s/\/$//sg;
#
# BUILD URL
#
$URL .= "/" . $method . "/?accountId=" . $account_id;
# Check if serverId is set
if ($serverId ne '') { $URL .= "&serverId=" . $serverId; }
# Check if startDate is set
if ($startDate ne '') { $URL .= "&startDate=" . $startDate; }
# Check if endDate is set
if ($endDate ne '') { $URL .= "&endDate=" . $endDate; }
# Check if timeZone is set
if ($timeZone ne '') { $URL .= "&timeZone=" . $timeZone; }
# Check if timeZone is set
if ($mailingId ne '') { $URL .= "&mailingId=" . $mailingId; }
# Check if timeZone is set
if ($messageId ne '') { $URL .= "&messageId=" . $messageId; }
# Check if timeZone is set
if ($index ne '') { $URL .= "&index=" . $index; }
# Check if timeZone is set
if ($count ne '') { $URL .= "&count=" . $count; }
# Check if type is set
( run in 1.526 second using v1.01-cache-2.11-cpan-39bf76dae61 )