Created
December 14, 2012 16:52
-
-
Save kcowgill/4286863 to your computer and use it in GitHub Desktop.
Hack to make Email::Sender::Transport::SMTP use Net::SMTP_auth instead of Net::SMTP (to support NTLM authentication)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/SMTP_old.pm b/SMTP.pm | |
index 23b508e..4f6f35d 100644 | |
--- a/SMTP_old.pm | |
+++ b/SMTP.pm | |
@@ -49,12 +49,12 @@ sub _quoteaddr { | |
sub _smtp_client { | |
my ($self) = @_; | |
- my $class = "Net::SMTP"; | |
+ my $class = "Net::SMTP_auth"; | |
if ($self->ssl) { | |
require Net::SMTP::SSL; | |
$class = "Net::SMTP::SSL"; | |
} else { | |
- require Net::SMTP; | |
+ require Net::SMTP_auth; | |
} | |
my $smtp = $class->new( $self->_net_smtp_args ); | |
@@ -65,7 +65,7 @@ sub _smtp_client { | |
$self->_throw("sasl_username but no sasl_password") | |
unless defined $self->sasl_password; | |
- unless ($smtp->auth($self->sasl_username, $self->sasl_password)) { | |
+ unless ($smtp->auth('NTLM', $self->sasl_username, $self->sasl_password)) { | |
if ($smtp->message =~ /MIME::Base64|Authen::SASL/) { | |
Carp::confess("SMTP auth requires MIME::Base64 and Authen::SASL"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Net::SMTP_auth is a subclass of Net::SMTP