Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

SMTP auth() command not supported on

by lighterjoul (Initiate)
on Jan 17, 2013 at 03:31 UTC ( #1013693=perlquestion: print w/replies, xml ) Need Help??
lighterjoul has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I wanna use MIME::Lite to send email from hotmail with attachment, however, I got the following error: SMTP auth() command not supported on anyone can help me? Best wishes! Following is my codes.
use strict; use MIME::Lite; my $gif = "mime.gif"; my $msg = MIME::Lite->new(From => '', To => '', Subject =>'Test the "attach to singlepart" hack', Type => 'TEXT', Data => ["This is a simple text message... ", "can we attach a file to it?\n"]); ### Attach a part: $msg->attach(Type => 'image/gif', Path => $gif); ### Output! $msg->print; $msg->send('smtp','', Port => 25, AuthUser=>'username +, AuthPass=>'upass');

Replies are listed 'Best First'.
Re: SMTP auth() command not supported on
by davido (Archbishop) on Jan 17, 2013 at 03:57 UTC


    Is port 25 blocked by your network or ISP? Also, be sure you're following the directions on that second link, such as using your full 'live' email address as a username.


Re: SMTP auth() command not supported on
by mbethke (Hermit) on Jan 17, 2013 at 04:10 UTC

    Apart from what davido said: I'm quite sure your problem is due to them (sensibly) requiring TLS for LOGIN (and you should probably use Port 587 for that). You'll have to manually use Net::SMTP::SSL to send the mail prepared by MIME::Lite because the latter doesn't support dependency injection, i.e. has no way for the user to specify their own Net::SMTP API-compatible module.

      Hi, mbethke,

      I had changed the port No. however, I still get the error.

       $msg->send('smtp','', Port => 587, AuthUser=>'', AuthPass=>'passwords');

      Meanwhile, I had tested the Net::SMTP::TLS, and in that case, I can sent the text messages by hotmail, but I can not send the attachements(I can get the attachements, but badly encoded or bad file size etc), can you check my codes? Many thanks..

      use strict; use MIME::Lite; use Getopt::Std; use MIME::Base64; use Authen::SASL; use Net::SMTP::SSL; use Net::SMTP::TLS; my $un=''; my $pw='passwords'; my $mh=''; my $pt=25; my $from = ''; my $to = ''; my $mailer = new Net::SMTP::TLS( $mh, Port => $pt, User => $un, Password => $pw, Timeout => 60, ) or die "Cannot create a TLS mailer instance!\n"; $mailer->mail($from); $mailer->to($to); $mailer->data(); my $msg = MIME::Lite->new( From => $from, 'Reply-to' => $from, To => $to, Subject => "test", Type => 'multipart/related' ) or die "Cannot create a new email instance!\n"; $msg->attach( Type => 'TEXT', Data => "test messages", ) or die "Error adding TXT: $!\n"; $msg->attach( Type => 'aplication/pdf', Path => 'test.pdf', Disposition => 'attachment' ) or die "Error adding PDF: $!\n"; $mailer->datasend($msg->as_string); $mailer->dataend(); $mailer->quit();

        You at least have a typo in your MIME-Type:

        Wrong : Type => 'aplication/pdf', Correct : Type => 'application/pdf',

        I don't know if that's the cause for the incorrect/corrupted attachments.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1013693]
Approved by davido
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2018-05-21 17:55 GMT
Find Nodes?
    Voting Booth?