<?xml version="1.0" encoding="windows-1252"?>
<node id="999747" title="Unable to do NTLM auth on mail sending script using Mail::Sender" created="2012-10-18 10:36:03" updated="2012-10-18 10:36:03">
<type id="115">
perlquestion</type>
<author id="999745">
barun2u</author>
<data>
<field name="doctext">
Hi, 
I'm trying to write a script to send email, and I'm using the Mail::Sender package for it. I'm using my company's exchange server to send it, which uses NTLM authentication. I'm not able to login. What am i missing? 

&lt;code&gt; 

use Mail::Sender; 
use Authen::NTLM; 

open my $DEBUG, "&gt;file.txt" or die "Can't open the debug file: $!\n"; 

my $sender = new Mail::Sender{ 
smtp =&gt; 'mail.company.com', #disguised 
on_errors=&gt;'die', 
from =&gt; 'sender@domain.com', 
to =&gt;'recipient@domain.com', 
subject =&gt; 'this is a test', 
auth =&gt;'NTLM', 
authid =&gt; 'user', 
authpwd =&gt; 'password', 
authdomain=&gt;'domain', 
debug =&gt; $DEBUG, 
debug_level=&gt;'4' 

} 
or die "$Mail::Sender::Error\n"; 

$sender-&gt;Open(); 
$sender-&gt;SendLineEnc("Hi,\n wasaaaaaaaa!\n"); 
$sender-&gt;Close(); 

&lt;/code&gt;

The error I get: Authentication unsuccessful 

Here's the complete log file - 
&lt;code&gt;
&gt;&gt; 220 025-SN1MMR1-003 Authenticated Client Access Receive Connector 
&lt;&lt; EHLO C9118DEF1EFEBC4.xxx.xxxxxxx.com 
&gt;&gt; 250-025-SN1MMR1-003.025d.xxx.xxx.net Hello [123.123.123.123] &lt;disguised&gt; 
&gt;&gt; 250-SIZE 73400320 
&gt;&gt; 250-PIPELINING 
&gt;&gt; 250-DSN 
&gt;&gt; 250-ENHANCEDSTATUSCODES 
&gt;&gt; 250-STARTTLS 
&gt;&gt; 250-AUTH NTLM 
&gt;&gt; 250-8BITMIME 
&gt;&gt; 250-BINARYMIME 
&gt;&gt; 250 CHUNKING 
&lt;&lt; AUTH NTLM 
&gt;&gt; 334 NTLM supported 
&lt;&lt; TlRMTVNTUAABAAAAB7IAAAcABwAgAAAABAAEACcAAABCWEMwNTU3QU1FUg== 
&gt;&gt; 334 TlRMTVNTUAACAAAACAAIADgAAAAFgoECwB/WyydSiQ8AAAAAAAAAANAA0ABAAAAABgGxHQAAAA8wADIANQBEAAIACAAwADIANQBEAAEAHgAwADIANQAtAFMATgAxAE0ATQBSADEALQAwADAAMwAEACIAMAAyADUAZAAuAG0AZwBkAC4AbQBzAGYAdAAuAG4AZQB0AAMAQgAwADIANQAtAFMATgAxA0ATQBSADEALQAwADAAMwAuADAAMgA1AGQALgBtAGcAZAAuAG0AcwBmAHQALgBuAGUAdAAFACIAMAAyADUAZAAuAG0AZwBkAC4AbQBzAGYAdAAuAG4AZQB0AAcACAAxkEKdoKzNAQAAAAA=
&lt;&lt; TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAgACABwAAAADgAOAHgAAAAOAA4AhgAAAAAAAABUAAAABYKBAmXjRHO4f7Up8gDJRi6go2ftbklSQhvUifVDfd1R0yIz1YrYKXls9nDGT9l6iw1J/zAAMgA1AEQAQgBYAEMAMAA1ADUANwBCAFgAQwAwADUANQA3AA== 
&gt;&gt; 535 5.7.3 Authentication unsuccessful 
&lt;&lt; quit 

&lt;/code&gt;
What am I doing wrong? The login and password are correct, and I can succesfully use this script to send mail through an outside smtp server ( for e.g. comcast, by using LOGIN protocol , though). 

Any help will be appreciated. 
Thanks! </field>
</data>
</node>
