Skip to content

Instantly share code, notes, and snippets.

@kcowgill
Created December 14, 2012 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcowgill/4286863 to your computer and use it in GitHub Desktop.
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)
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");
}
@kcowgill
Copy link
Author

Net::SMTP_auth is a subclass of Net::SMTP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment