#!/usr/bin/perl -wT use strict; use Mail::Address; use Mail::Header; use Mail::Internet; use Net::SMTP; use constant SMTP_HOST => 'smtp.domain.com'; #Build the Email Addresses my $to = Mail::Address->new('Firstmame Lastname', 'user@domain.com'); my $from = Mail::Address->new('My Name', 'me@domain.com'); #Build the Headers my $header = Mail::Header->new; $header->add(To => $to->format); $header->add(From => $from->format); $header->add(Subject => 'test subject'); #Build the Message my $mail = Mail::Internet->new( Header => $header, Body => ['test body string, or an arrayref of body lines'], ); #Send the Message $mail->smtpsend(Host => SMTP_HOST) or die 'Could not send message to ', $to->format;