I prefer to use the CGI module to retrieve form data into a hash, build it into a formatted string, then use MIME::Lite to build and send an email. If it must work for any form, I use hash lookup tables to format and validate values from known field names.