Whoa! The best tip is: If you're in a perl script, stay there. Try using
Mail::Sendmail instead. If you still need to use a command line, try 'sendmail -s...'. Remember that the Subject and To lines in an email message are actually just text that might as well be in the body of the message. (but you don't need to worry about that if you use the module above.)