#!/usr/bin/perl use strict; use MIME::Lite; use Time::localtime; use MIME::Words qw(:all); use Encode; my $mailtext=""; mail(); sub mail { my $sendmail = "/usr/sbin/sendmail -t"; my $from = "myadress@email.com"; my $reply_to = "myadress@email.com"; my $subject = "Subject ü ä ö"; my $mail_message = "This is a text with ü ä and ö"; #Subject encoding utf8::decode($subject); # Create new mail my $msg = MIME::Lite->new ( Subject => $subject, From => $from, To => 'mymail@mail.com', Type => 'multipart/mixed', Charset => 'utf-8' ); # Mailtext $mailtext=$mail_message; $msg->attach ( Type => 'TEXT', Data => $mailtext ); # Send mail MIME::Lite->send("sendmail", $sendmail); $msg->send; } exit;