Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: SMTP auth() command not supported on

by lighterjoul (Initiate)
on Jan 17, 2013 at 08:34 UTC ( #1013728=note: print w/ replies, xml ) Need Help??

in reply to Re: SMTP auth() command not supported on
in thread SMTP auth() command not supported on

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();

Comment on Re^2: SMTP auth() command not supported on
Select or Download Code
Replies are listed 'Best First'.
Re^3: SMTP auth() command not supported on
by Corion (Pope) on Jan 17, 2013 at 08:42 UTC

    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.

      opps... very sorry for my carefulless...

      I can get the pdf attachment right now, but the pdf size is not correct, the original pdf size is 42.2KB, but the attachment size in the email is 11.4KB, and that pdf can not be opened, very strange... I guess if the MIME::Lite destroied the PDF file?

        Aaah - I think I fought MIME::Lite on that front at one time. If you are on Windows, MIME::Lite does not always know to binmode the file used for an attachment. For .xls files, I now manually patch the mime type to application/, which seems to do what I need, but I have old and disabled code that forced a binary attachment:

        $msg->attach( Type => $type, Disposition => 'attachment', Path => $filename, Filename => basename($filename), Binmode => 1, );

        If you are not on Windows, or that does not fix the problem, are you sure that the files to be attached have been written completely and their filehandles closed?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013728]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2015-11-26 23:42 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (710 votes), past polls