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