sub send_mail { my ($send_from,$subject,$message) = @_; open(SENDMAIL, "|/usr/sbin/sendmail -oi -t") or warn "cannot open pipe $!" and return ("Sorry you email coudn't be send. $!"); print SENDMAIL "From: $send_from \n"; print SENDMAIL "To: aaa\@aaa.com \n"; print SENDMAIL "Subject: $subject \n"; print SENDMAIL "\n"; print SENDMAIL "$message \n"; close(SENDMAIL) or return ("Sorry you email coudn't be send. $!"); return("Email sended.Contact. Thanks for your opinion."); }