Subject: | Problems with interoperation with Email::Send::SMTP |
The attached patch makes sure Net::SMTP::TLS returns true in the places
that Email::Send::SMTP expects it to return true. It also adds very
basic support for the Debug option that Net::SMTP supports.
Another thing it fixes to work with Email::Send::SMTP, is to accept data
to ->data(), which it forwards to datasend and calls dataend, to do it
the same way as Net::SMTP does it.
if I need to change anything in the patch to have it applied and
released, please let me know.
Subject: | net-smtp-tls-patch.01.patch |
--- TLS.pm.old 2007-09-03 16:47:40.000000000 +0200
+++ TLS.pm 2007-09-03 16:57:02.000000000 +0200
@@ -129,6 +129,7 @@
sub _command {
my $me = shift;
my $command = shift;
+ warn "< " . $command . "\n" if $me->{Debug};
$me->{sock}->printf($command."\015\012");
}
@@ -137,6 +138,8 @@
sub _response {
my $me = shift;
my $line = $me->{sock}->getline();
+ warn "> " . $line if $me->{Debug};
+
my @rsp = ($line =~ /(\d+)(.)([^\r]*)/);
# reverse things so the seperator is at the end...
# that way we don't have to get fancy with the return
@@ -278,6 +281,7 @@
if(not $num == 250){
croak "Could't set FROM: $num $txt\n";
}
+ return 1;
}
# send the RCPT TO: <addr> command
@@ -315,6 +319,13 @@
if(not $num == 354){
croak "Data failed: $num $txt\n";
}
+ # We try to send data as well, if we have additional parameters,
+ # since Net::SMTP does this.
+ if (scalar(@_)) {
+ $me->datasend(@_);
+ $me->dataend();
+ }
+ return 1;
}
# send stuff over raw (for use as message body)
@@ -360,6 +371,7 @@
my $wout;
if (select(undef,$wout=$win, undef, $timeout) > 0 or -f $cmd->{sock}) # -f for testing on win32
{
+ warn "< " . $line;
my $w = syswrite($cmd->{sock}, $line, $len, $offset);
unless (defined($w))
{
@@ -374,7 +386,7 @@
return undef;
}
}
-
+ return 1;
}
# end the message body submission by a line with nothing