Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

MIME::Lite error => SMTP auth() command not supported on

by ted.byers (Monk)
on Sep 13, 2011 at 21:12 UTC ( #925773=perlquestion: print w/replies, xml ) Need Help??
ted.byers has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

I have a particularly obscure and puzzling problem. The following code works perfectly on my workstation (64 bit Windows 7, 64 bit Activestate perl 5.12). I am trying to set the script up on a Server running Windows Server 2003 (but the same version of Perl - in fact, I copied the whole C:\Perl64 directory tree from the above workstation to the server, which happend very quickly over a 1GB LAN, and set up the environment variables appropriately)

Alas, the problem is that while the script works perfectly on the workstation, it dies with the above error on the server.

I did do a search of this forum, and found information about 'use Authen::SASL qw(Perl);'. Authen::SASL is in fact installed, and adding the use statement 'use Authen::SASL qw(Perl);' at the beginning of the script changes nothing!

Here is the code:

use strict; use MIME::Lite; my $subject="A first MIME::Lite test on gmail"; my $message="A Daily PDF report is attached.Just to see if this works" +; my $to = "r.ted.byers\"; my $file = "mysamplefile.pdf"; my $from = "\"Me\" <me\>"; print "Sending test email.\n"; make_and_send_email($from,$to,$subject,$message,$file); print "Test email sent.\n"; sub make_and_send_email{ my ($from, $to,$subject,$message, $path) =@_; my $un='myun'; my $pw='mypwd'; my $msg = MIME::Lite->new( From => $from, 'Reply-to' => $from, To => $to, Subject => $subject, Type =>'multipart/related' ) or die "Cannot create a new email instance!"; $msg->attach(Type => 'TEXT', Data => $message, ) or die "Error adding TXT: $!\n"; $msg->attach(Type => 'aplication/pdf', Path => $path, Disposition => 'attachment' ) or die "Error adding PDF: $!\n"; MIME::Lite->send('smtp','',AuthUser=>$un, AuthPass=>$p +w, Timeout => 60); $msg->send(); return 0; }

Here is the output on the workstation:

C:/Perl64/bin\perl.exe -w c:/Work/ 
Sending test email.
Test email sent.

Compilation finished at Tue Sep 13 11:33:59

and here is the output on the server:

C:/Perl64/bin\perl.exe -w c:/Work/ 
Sending test email.
SMTP auth() command not supported on

Compilation exited abnormally with code 255 at Tue Sep 13 16:47:12

Since I copied everything in C:\Perl64 on the workstation to the same location on the server (and set PERL_HOME to C:\Perl64 as an environment variable), what could possibly be different between the two machines that would account for the different outcomes? Of course, I used the same credentials on both machines.

This is the first time I have shifted code from one machine to another only to find it breaking (and in fact I do this alot).

Any guidance on how to fix this would be appreciated.



  • Comment on MIME::Lite error => SMTP auth() command not supported on
  • Download Code

Replies are listed 'Best First'.
Re: MIME::Lite error => SMTP auth() command not supported on
by keszler (Priest) on Sep 14, 2011 at 00:17 UTC

    Is MIME::Base64 installed?

    MIME::Lite->send('smtp'... uses Net::SMTP, which in its auth method does:

    eval { require MIME::Base64; require Authen::SASL; } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL tod +o auth"]), return 0;

    MIME::Lite code includes:

    if ($smtp->supports('AUTH',500,["Command unknown: 'AUTH'"])) { $smtp->auth( $args{AuthUser}, $args{AuthPass} ) or die "SMTP auth() command failed: $!\n" . $smtp->message . "\n"; } else { die "SMTP auth() command not supported on $hostname\n"; }

    It appears possible that the lack of MIME::Base64 could result in the error you're seeing.


      Yes, MIME::Base64 is installed.

      What else might be awry?

        In all of the MIME::Lite code that particular error message only appears once, as shown. Net::SMTP->supports('AUTH'... fails, that error is generated. So, why does it fail from the server when it succeeds on your workstation. Same Perl, same modules; time to look elsewhere. Is the server blocked from connecting to Since this is email, is something on your network redirecting email ports to local email servers?

        On the server, at a DOS prompt, try:

        > telnet 25

        If you get a connection, you'll see something like 220 If you can't connect, or get a local email server - there's your problem.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://925773]
Approved by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-10-20 00:30 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (111 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!