sub sendmail { my $server = 'emailserver.com'; my $from = 'myemail@emailserver.com'; my $disguise = 'mygmail@gmail.com'; my $to = $_[0]; my $subject = $_[1]; my $body = $_[2]; use MIME::Lite; my $msg; $msg = MIME::Lite -> new( From => $from, To => $to, CC => $from, Subject => $subject, Type => 'text/html', Data => qq{$body} ); if(not $msg ->send('smtp', $server, Timeout => 60, Debug => 1)){ die "Can not send the message.\n"; } }