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

Send an E-mail using NET::SMTP

by Zitoune (Beadle)
on Oct 09, 2003 at 19:43 UTC ( #298079=perlquestion: print w/replies, xml ) Need Help??

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

I'm using NET::SMTP to send a mail with a zip attach to it ( MIME::Lite ).
The problem is that when i'm sending my mails it's going through the mail server as a guest, but now i need to put a username, password and name server if i want to send mails, but i can't find a way of doing it, could you help me ??

Exemple :
$msg = MIME::Lite->new( From =>"Me", To =>'Someone', Subject =>'Zip Files', Type =>'Application/zip', Encoding =>'base64', Path =>'Dummy.zip' ); $str = $msg->as_string; #$smtp = Net::SMTP->new("mailhost"); $smtp->mail($ENV{USERNAME}); $smtp->to(you@you.com); $smtp->data(); $smtp->datasend($str); $smtp->dataend(); $smtp->quit;

I hope i'm clear enough.

Replies are listed 'Best First'.
Re: Send an E-mail using NET::SMTP
by tcf22 (Priest) on Oct 09, 2003 at 20:05 UTC
    Not sure if MIME::Lite supports authentication.

    Try Mail::Sender by jenda. It supports authentication to the SMTP server.
    $sender->MailMsg({ smtp => 'mail.server.com', from => 'somebody@perlmonks.org', to => 'tcf22@perlmonks.org', subject => 'Sample', msg => 'Mail Sender Sample', auth => 'NTLM', authid => 'tom', authpwd => 'pass' }) || die "$Mail::Sender::Error\n";
    Update: Added Code Sample.

    - Tom

      I have problem installing the package.
      Is there any PPM file available ??

        http://Jenda.Krynicky.cz/perl

        Jenda
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
           -- Rick Osborne

        Edit by castaway: Closed small tag in signature

Re: Send an E-mail using NET::SMTP
by phydeauxarff (Priest) on Oct 09, 2003 at 20:21 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2023-12-08 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (35 votes). Check out past polls.

    Notices?