use warnings; use strict; use Email::MIME; use Email::Sender::Simple 'sendmail'; use Email::Sender::Transport::SMTP; my $message = Email::MIME->create( header_str => [ From => 'test@example.com', To => $ENV{USER}.'@localhost', Subject => 'Happy birthday!', ], attributes => { encoding => 'quoted-printable', charset => 'ISO-8859-1', }, body_str => "Happy birthday to you!\n", ); sendmail($message, { from => 'test@example.com', transport => Email::Sender::Transport::SMTP->new( { host => 'localhost', port => 25 }), });