Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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 =>'' ); $str = $msg->as_string; #$smtp = Net::SMTP->new("mailhost"); $smtp->mail($ENV{USERNAME}); $smtp->to(; $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 => '', from => '', to => '', 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 ??

        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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-11-29 12:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found