in reply to Simple SMTP email within script...

Since you're so close already, your Perl script could simply compose the message in a temp file and then call a Unix utility like "mailx".