i currently have a perl script that sends an e-mail though smtp, now the server has been changed and outgoing e-mail requires authenication, how do i add this to the perl so that i can send outgoing e-mails through my script again? here is a portion of the script currently:
use Net::SMTP;
$toemail = lc($toemail);
$smtp = Net::SMTP->new("$mailserver"
; # connect to an SMTP server
$smtp->mail( "$fromemail" ); # use the sender's address here
$smtp->to("$toemail"
; # recipient's address
$smtp->data(); # Start the mail
# Send the header.
$smtp->datasend("From: $fromemail\n"
;
$smtp->datasend("To: $toemail\n"
;
$smtp->datasend("Subject: $subject\n"
;
$smtp->datasend("\n"
;
# Send the body.
$smtp->datasend("text"
;
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
}
use Net::SMTP;
$toemail = lc($toemail);
$smtp = Net::SMTP->new("$mailserver"
$smtp->mail( "$fromemail" ); # use the sender's address here
$smtp->to("$toemail"
$smtp->data(); # Start the mail
# Send the header.
$smtp->datasend("From: $fromemail\n"
$smtp->datasend("To: $toemail\n"
$smtp->datasend("Subject: $subject\n"
$smtp->datasend("\n"
# Send the body.
$smtp->datasend("text"
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
}