paragkalra has asked for the wisdom of the Perl Monks concerning the following question:

I have written following code.

use MIME::Lite; # set up email $to = "myname\@domain.com"; $from = "myname\@domain.com"; $subject = "Email Sent via Perl"; $message = "This email was sent using Perl."; # send email email($to, $from, $subject, $message,); # email function sub email { # get incoming parameters local ($to, $from, $subject, $message) = @_; # create a new message $msg = MIME::Lite->new( From => $from, To => $to, Subject => $subject, Data => $message ); # send the email MIME::Lite->send('smtp', 'microsoft.exchange.server', AuthUser=>'myna +me', AuthPass=>'my_password', Debug=>1); $msg->send(); }
When I am executing the code. I am getting following error.

MIME::Lite::SMTP>>> MIME::Lite::SMTP MIME::Lite::SMTP>>> Net::SMTP(2.29) MIME::Lite::SMTP>>> Net::Cmd(2.26) MIME::Lite::SMTP>>> Exporter(5.58) MIME::Lite::SMTP>>> IO::Socket::INET(1.29) MIME::Lite::SMTP>>> IO::Socket(1.29) MIME::Lite::SMTP>>> IO::Handle(1.25) MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 220 CAS1.microsoft.exchange.server + Microsoft ESMTP MAIL Service ready at Mon, 4 May 2009 13:39:01 +0530 MIME::Lite::SMTP=GLOB(0x1b5e3e4)>>> EHLO localhost.localdomain MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-CAS1.microsoft.exchange.server + Hello [172.16.4.115] MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-SIZE 10485760 MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-PIPELINING MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-DSN MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-ENHANCEDSTATUSCODES MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-STARTTLS MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-AUTH GSSAPI NTLM MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-8BITMIME MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250-BINARYMIME MIME::Lite::SMTP=GLOB(0x1b5e3e4)<<< 250 CHUNKING No SASL mechanism found at C:/Perl/site/lib/Authen/SASL.pm line 74
The server through which I am trying to send the email is an Microsoft exchange Server.

Just FYI - I generally use 'Thunderbird' as my email client I am being able to send/receive emails through exchange server.

Under SMTP section following settings are configured:

Port: 25
Use secure connection: No

On the other hand to receive emails I am using port 993 through SSL

Replies are listed 'Best First'.
Re: Unable to use 'MIME::Lite' though exchange server.
by Anonymous Monk on May 04, 2009 at 09:05 UTC
      I am unable to find "Authen::SASL::NTLM"

      This is what I am getting:

      cpan> install Authen::SASL::NTLM Warning: Cannot install Authen::SASL::NTLM, don't know what it is. Try the command i /Authen::SASL::NTLM/ to find objects with matching identifiers. cpan>
        It doesn't exist. You need to write/create Authen::SASL::NTLM, you can use Authen::NTLM to help you do that.
Re: Unable to use 'MIME::Lite' though exchange server.
by december (Pilgrim) on May 04, 2009 at 14:03 UTC

    I think it means of the authentication methods the server supports (GSSAPI NTLM), your client doesn't support any. SASL is a library for authentication often used in for instance SMTP and POP3/IMAP servers, I believe it came forth from the Cyrus IMAP server.

    If you can't find any module to support SASL/GSSAPI or SASL/NTLM correctly, you could perhaps send the email without authentication... Or try to pipe it through the local mail server if whatever mail injection binary your MTA has, supports arguments for remote authentication.