Any ideas?
[edited by: jatar_k at 7:26 pm (utc) on Dec. 27, 2004]
[edit reason] no personal urls thanks [/edit]
There's really no way to do the exact visual duplicate except with a PDF, and that requires a full version with plug-ins for all users who might view it.
In regular email, once encoded, the data is encoded in key-value pairs, and generally decoded as plain text. When you put plain text back into an email with no foreknowledge of how it is to be received, what fonts are going to be used to affect your output, the results can be unpredictable. You can, however, reformat it in a way that makes sense.
As for an attachment - look up the MIME:Lite module at a CPAN near you. This module makes automating attachments a breeze. It also makes it easy to output a multi-part mime type so you can deliver both plain text and HTML format, which may get you even closer to your look-alike formatting.
Any ideas?
This should be pretty straight forward; as you can create an HTML email simply including the following headers:
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
You will have to work out how to set the email headers using whatever method you are using to send the email - you probably do it in the same place that you set the "From:" header.
Then, your email message body simply begins with "<HTML><BODY>", contains your form HTML with the fields pre-populated with the submitted content, and ends with </HTML></BODY> just as any other HTML document.
A nice way to architect this would be to have a single function that generates the form HTML which is then used to craft both your page and the email. This would mean that you only have to make changes in one place when your form content changes.
If you've never done form to email at all, you really need to step back from this requirement, learn how to do a simple form to email first, and then look at doing this.
Hope this helps!