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?
use Mail::Sender;
use Authen::NTLM;
open my $DEBUG, ">file.txt" or die "Can't open the debug file: $!\n";
my $sender = new Mail::Sender{
smtp => 'mail.company.com', #disguised
on_errors=>'die',
from => 'sender@domain.com',
to =>'recipient@domain.com',
subject => 'this is a test',
auth =>'NTLM',
authid => 'user',
authpwd => 'password',
authdomain=>'domain',
debug => $DEBUG,
debug_level=>'4'
}
or die "$Mail::Sender::Error\n";
$sender->Open();
$sender->SendLineEnc("Hi,\n wasaaaaaaaa!\n");
$sender->Close();
The error I get: Authentication unsuccessful
Here's the complete log file -
>> 220 025-SN1MMR1-003 Authenticated Client Access Receive Connector
<< EHLO C9118DEF1EFEBC4.xxx.xxxxxxx.com
>> 250-025-SN1MMR1-003.025d.xxx.xxx.net Hello [123.123.123.123] <disgu
+ised>
>> 250-SIZE 73400320
>> 250-PIPELINING
>> 250-DSN
>> 250-ENHANCEDSTATUSCODES
>> 250-STARTTLS
>> 250-AUTH NTLM
>> 250-8BITMIME
>> 250-BINARYMIME
>> 250 CHUNKING
<< AUTH NTLM
>> 334 NTLM supported
<< TlRMTVNTUAABAAAAB7IAAAcABwAgAAAABAAEACcAAABCWEMwNTU3QU1FUg==
>> 334 TlRMTVNTUAACAAAACAAIADgAAAAFgoECwB/WyydSiQ8AAAAAAAAAANAA0ABAAAA
+ABgGxHQAAAA8wADIANQBEAAIACAAwADIANQBEAAEAHgAwADIANQAtAFMATgAxAE0ATQBS
+ADEALQAwADAAMwAEACIAMAAyADUAZAAuAG0AZwBkAC4AbQBzAGYAdAAuAG4AZQB0AAMAQ
+gAwADIANQAtAFMATgAxA0ATQBSADEALQAwADAAMwAuADAAMgA1AGQALgBtAGcAZAAuAG0
+AcwBmAHQALgBuAGUAdAAFACIAMAAyADUAZAAuAG0AZwBkAC4AbQBzAGYAdAAuAG4AZQB0
+AAcACAAxkEKdoKzNAQAAAAA=
<< TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAgACABwAAAADgAOAHgAAAAOAA4AhgAA
+AAAAAABUAAAABYKBAmXjRHO4f7Up8gDJRi6go2ftbklSQhvUifVDfd1R0yIz1YrYKXls9
+nDGT9l6iw1J/zAAMgA1AEQAQgBYAEMAMAA1ADUANwBCAFgAQwAwADUANQA3AA==
>> 535 5.7.3 Authentication unsuccessful
<< quit
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!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.