NAME
Net::SMTP::Bulk::Coro - NonBlocking batch SMTP using Net::SMTP interface via Coro+AnyEvent
VERSION
Version 0.23
SYNOPSIS
This is a rewrite of Net::SMTP using AnyEvent and Coro as a backbone. It supports AUTH, SSL and STARTTLS as well. This module can be used as a drop in replacement for Net::SMTP. At this point this module is EXPIREMENTAL, so use at your own risk. Functionality can change at any time.
use Net::SMTP::Bulk;
my $smtp = Net::SMTP::Bulk::Coro->new($server, %options);
See Net::SMTP for syntax.
SUBROUTINES/METHODS
new($server,%options)
new(%options)
Options: Host - Hostname or IP address
Port - The port to which to connect to on the server (default: 25)
Hello - The domain name you wish to connect to (default: [same as server])
Debug - Debug information (0-10 depending on level) (default: 0 [disabled]) OPTIONAL
Secure - If you wish to use a secure connection. (0 - None, 1 - SSL [no verify], 2 - SSL [verify], 3 - STARTTLS [no verify], 4 - STARTTLS [verify]) OPTIONAL [Requires Net::SSLeay]
Threads - How many concurrent connections per host (default: 2) OPTIONAL
Encode - Encode socket( 1: utf8 )
Callbacks - You can supply callback functions on certain conditions, these conditions include:
connect_pass,connect_fail,auth_pass,auth_fail,reconnect_pass,reconnect_fail,pass,fail,hang
The callback must return 1 it to follow proper proceedures. You can overwrite the defaults by supplying a different return.
1 - Default
101 - Remove Thread permanently
102 - Remove thread temporarily and reconnect at end of batch
103 - Remove thread temporarily and restart at end of batch (If your using an SMTP server with short timeout, it is suggested to use this over reconnect)
104 - Remove Thread temporarily
202 - Reconnect now
203 - Restart now
new(%options, Hosts=>[\%options2,\%options3])
You can supply multiple hosts in an array.
auth( [ MECHANISM,] USERNAME, PASSWORD )
*Requires Authen::SASL
mail( ADDRESS )
to( ADDRESS )
data()
datasend( DATA )
dataend( DATA )
reconnect( )
quit( )
$self->_READ($k);
if ($self->{status_code}{ $k->[0] }{ $k->[1] } == 220) {
my $r=$self->_FUNC('connect_pass',$self,$k,0,$self->{queue}{ $k->[0] }{ $k->[1] });
if ($r != 1) {
$self->_FUNC_CALLBACK($k,0,$r);
}
} else {
#FAIL TO CONNECT
my $r=$self->_FUNC('connect_fail',$self,$k,0,$self->{queue}{ $k->[0] }{ $k->[1] });
if ($r == 1) {
$self->_FUNC_CALLBACK($k,0,101); #remove thread
} else {
$self->_FUNC_CALLBACK($k,0,$r);
}
}
while (1) { if ($sock->connect_SSL) { # will not block $self->_DEBUG($k,'IO::Socket::SSL connected') if $self->{debug} >= 1; last; } else { # handshake still incomplete $self->_DEBUG($k,'IO::Socket::SSL not connected yet') if $self->{debug} >= 1; if ( IO::Socket::SSL->want_read() ) { $sel->can_read; } elsif ( IO::Socket::SSL->want_write()) { $sel->can_write; } else { $self->_DEBUG($k,'IO::Socket::SSL unknown error: '. $IO::Socket::SSL::SSL_ERROR) if $self->{debug} >= 1; #SSL ERROR } } }
AUTHOR
KnowZero
BUGS
Please report any bugs or feature requests to bug-net-smtp-bulk at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-SMTP-Bulk. 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 Net::SMTP::Bulk
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 2013 KnowZero.
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.