in reply to Using Mailx

try this:
open MAIL, "| mailx -s '$Subject' -r ReplyAddress $MailAddress"; print MAIL $MailMessage; close MAIL;