my $text = function(arguments); print SENDMAIL << "EOF"; From: me\@abc.com To: you\@xyz.com $text EOF close(SENDMAIL);