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

SMTP auth() command not supported on smtp.live.com

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 smtp.live.com 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 => 'user@hotmail.com', To => 'to@gmail.com', 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','smtp.live.com', Port => 25, AuthUser=>'username +, AuthPass=>'upass');

Comment on SMTP auth() command not supported on smtp.live.com
Download Code
Re: SMTP auth() command not supported on smtp.live.com
by davido (Archbishop) on Jan 17, 2013 at 03:57 UTC

    WAIT!

    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.


    Dave

Re: SMTP auth() command not supported on smtp.live.com
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','smtp.live.com', Port => 587, AuthUser=>'username@hotmail.com', 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='username@hotmail.com'; my $pw='passwords'; my $mh='smtp.live.com'; my $pt=25; my $from = 'username@hotmail.com'; my $to = 'touser@gmail.com'; 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-07-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls