use HTML::Entities;
use strict;
my $input = 'Не просто';
$input = decode_entities($input);
# Sendmail stuff
my %mail;
$mail{'Content-type'} = 'text/plain; charset="utf-8"';
$mail{smtp} = 'smtp.mycompany.com';
$mail{From} = 'server@mycompany.com';
$mail{To} = 'me@mycompany.com';
$mail{Subject} = 'Sendmail Test';
$mail{Message} = $input;
use Mail::Sendmail;
Mail::Sendmail::sendmail(%mail) || print STDERR $Mail::Sendmail::error;
####
# Sender setup
use Mail::Sender::Easy qw(email);
email({
smtp => 'smtp.mycompany.com',
from => 'server@mycompany.com',
to => 'me@mycompany.com',
subject => 'Sender Test',
charset => 'utf-8',
_text => $input,
}) || print STDERR "email() failed: $@";