Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

embed a form in an email

by malaga (Pilgrim)
on Apr 16, 2005 at 10:00 UTC ( #448439=perlquestion: print w/replies, xml ) Need Help??

malaga has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm having trouble finding information on the following: I need to embed a form in an html email. When the recipient receives the email, they should be able to fill in and submit the form right from their inbox. i'm able to make it work with a simple form that gets sent to a mailto: address - it simply brings up an email with the To, From and Subject filled in, but i can't make it work when sending to a cgi script on a remote server by referencing the entire url to the script - I get an error that the file can't be found and the error references my local temporary internet file cache.

1. Is this even possible?
2. What's the trick?

Thank you,

Replies are listed 'Best First'.
Re: embed a form in an email
by merlyn (Sage) on Apr 16, 2005 at 10:49 UTC
    "HTML Email" shouldn't exist, and doesn't for me. If you send me "HTML Email", it gets discarded, and you get a note back saying "don't do that". (If you send me an HTML payload along with plain text, I discard the HTML payload... see "A MIME is a terrible thing to waste".)

    So, unless you know that your audience really really does want this, I'd suggest simply emailing a URL that someone can come visit, and that has your form on it.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: embed a form in an email
by g0n (Priest) on Apr 16, 2005 at 11:02 UTC
    While I agree with merlyn about html email (I delete html email unread before it reaches the mail client), and your question is not especially perlish, it sounds like:

    • A laudably cautious mail client is converting external urls to local urls
    • or possibly your 'action' in the form is incorrect, or incorrectly formatted
    If this is for company internal use only (and I hope it is, otherwise you are likely to meet with an unsympathetic response), you could post the form that you are using, and what mail client is used in your company.

    I'm not sure I understand how 'i'm able to make it work with a simple form that gets sent to a mailto: address - it simply brings up an email with the To, From and Subject filled in' relates to the rest of it though.

    g0n, backpropagated monk
Re: embed a form in an email
by bradcathey (Prior) on Apr 16, 2005 at 12:02 UTC

    While I agree whole-heartedly with merlyn, et al, (I personally do not accept any HTML e-mail), but am still curious why you can't get it to work. Are you using an absolute or relative path in your action tag? How about posting some code, though this is a bit O.T. for a Perl forum. But we're a friendly bunch...

    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re: embed a form in an email
by Thelonious (Scribe) on Apr 17, 2005 at 13:08 UTC
Re: embed a form in an email
by ambs (Pilgrim) on Apr 18, 2005 at 14:53 UTC
    Just don't do that. Add the form as plain text, ask the user to fill it out, and do a reply. In the server add some Mail::Audit or similar script to proccess it. For me, messages containing HTML tags are moved automatically to the Junk...

    Alberto Simões

Re: embed a form in an email
by tirwhan (Abbot) on Apr 18, 2005 at 14:50 UTC
    You probably shouldn't do this. Many sites block emails which contain form elements, even if they allow HTML emails in principle. This is necessary due to the large amounts of security holes which have occurred in several email clients when processing forms.
Re: embed a form in an email
by malaga (Pilgrim) on Apr 23, 2005 at 17:40 UTC
    Thanks for the reponses - I finally figured it out after much trial and error. don't know why it was so hard, but 2 things: had to use GET not POST, and the other part was due to the proprietary software they want to use to send this - had to be fully compliant xhtml.

    I have no excuse for doing this other than the recipients are signed up for this email, so it's really between my client and their clients. I've already given them my opinion - i don't know for sure and life is too short to find out - but i think that adding forms to the html email will cause even more isp's to kick it back. they still want to try it.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://448439]
Front-paged by monkfan
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2020-10-24 17:37 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (246 votes). Check out past polls.