#!/usr/local/bin/perl use strict; use warnings; use Net::SMTP; my $smtp = Net::SMTP->new('smtp.xxxxx.com', Port => 25, Timeout => 20, Debug => 1 ); my $sender = my $user = 'username@xxxxx.com'; my $password = 'xxxxxxxx'; print "Trying to authenticate.."; $smtp->auth( $user, $password ) or die "could not authenticate\n"; my $receiver = 'username@xxxxx.com'; $smtp->mail( $sender ); $smtp->to( $receiver ); $smtp->data(); $smtp->datasend( "To: $receiver\n" ); $smtp->datasend( "From: $sender\n" ); $smtp->datasend( "Content-Type: text/html\n" ); $smtp->datasend( "Subject: Testing Net::SMTP" ); $smtp->datasend( "\n" ); $smtp->datasend( 'The body of the email' ); $smtp->dataend(); $smtp->message(); $smtp->quit();