smtp server and auth

Dan deHam <[email protected]> Tue, 24 May 2005 10:24:07 -0700
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
Hello,

How do I send email using Mail-Box and an smtp server that requires 
authentication? How do I give send the username, password, and server 
address? Please show me how to modify the send.pl example to do this. 
Please help me.

Thanks,

Dan

#!/usr/bin/perl

# Demonstration on sending simple messages.
#
# This code can be used and modified without restriction.
# Mark Overmeer, <[email protected]>, 20 nov 2001
# 16 jan 2003, added some options

use warnings;
use strict;
use lib '..', '.';

use Mail::Box;

#
# Get the command line arguments.
#

die "Usage: $0 email-address\n"
     unless @ARGV==1;

my $email = shift @ARGV;

#
# Create a simple message
#

my $message = Mail::Message->build
   ( From    => '[email protected]'
   , To      => $email
   , Subject => 'A sunny day'
# , Cc      => 'NINJA <ninja>, Mark Overmeer <markov>'

   , data => <<'TEXT'
This is an automatically generated message.
I hope you have a nice day.
TEXT
  );

#
# Transmit the message, leaving the decission how over to the
# Mail::Transmit package.
#

warn "Sending returned error $!\n"
    unless $message->send;

$message->send
   ( via        => 'sendmail'      # you can do even without this line
# , trace      => 'NOTICE'
# , executable => 'C:\lib\sendmail.exe'
# , debug_smtp => 1
# , timeout    => 300
# , retry      => 5
   );