问题
I've had several clients ask this, and I've never been able to get or give a satisfactory answer. Can you (practically) put a working form into an HTML email?
My understanding is that you can, but that there's no guarantee of email clients properly handling it, so that method would only be practical with individual recipients that you'd had a chance to test with, rather than with huge mailing lists of people using diverse email clients. But my understanding comes from a lot of developer friends shrugging at the question and no authority that I've found giving a clear answer either way.
What does Stack Overflow think? What's the best answer when you're asked to do this by a client who, for instance, wants a few hundred people to fill out a survey?
(Don't bother just answering "provide a link to a form on a website". That's the obvious answer. I want to know specifically if there's a consensus about forms in email.)
回答1:
1. HTML in email is perceived by some to be a blight
It just hardly ever works, and when it does work, it doesn't work properly.
I recently experienced a case where a rather lengthy html email, although well composed and worked rather well, was cut in half and prematurely trimmed by GMail ( due to length ) which mangled the design a bit.
I've also had cases where the HTML was so malformed the email turned up in my inbox as if it were really a blank email.
2. I don't trust forms in my email
For security reasons mostly, some clients may intercept the form action, and the post action won't go anywhere ( Especially in cases where they have a physical email client, Open Web browser and posting data via it, thats rather complicated ).
You are simply better off having a form on a website that you can control, and people don't have any nasty surpises about ( Especially if you need javascript to execute the form, many email clients won't put up with that )
Maybe, you can put a form in, but for the sake of sanity, be as backwards compatible as possible, so that somebody with a text based browser like Pine or Mutt can still read it, and be given a link to a working form that doens't require client magic.
回答2:
Simple answer is no, you can't. Try telling your client something like this:
Hardly any email clients will allow HTML forms in email, and some spam systems specifically block and delete emails that contain forms. This is due to security. There's a good chance that not even a fifth of the emails that are send with forms in them will even reach the recipients in-box.
回答3:
Yes, I've seen this done (emails from LiveJournal do this, as an example). As you mention it's not something you should rely upon working, though. Just putting an HTML form with action set to the full URL to post to should work wherever it's supported, however.
It's worked in most web-based email systems I've used but I don't know how many standalone clients would deal with it.
回答4:
You're correct - it's very unlikely that any significant portion of email clients will handle this well. It's hard enough getting plain HTML to work consistently in email clients, let alone "advanced" functionality like forms. I promise you that if you send it out to an audience with a heterogeneous mix of email clients, at least 80% of them will say "your form doesn't work".
If you're not sure, sign up for half a dozen free email accounts, plus one you can access via imap. Send the email with a simple form to all the account, plus view the imap one through 3 different clients (say, Thunderbird, Outlook, and Eudora). See if it works, and let us know.
回答5:
I would just provide a link to the survey/form capture site.
The problem you have is -
a. Not everyone accepts HTML email
b. How are you going to handle validation? Even if the form did submit from within the mail client to the destination server, you'd need to handle validation on the server. That's got potential to confuse the hell out of folk in a 'I started the form here, now I'm here...what gives?' kind of way.
回答6:
If there's no guarantee of clients properly handling it, I would say it's impractical. Do you really want to be sending mails out where the recipient will perform some action, and then it may or may not have actually been accomplished?
I also would find this most annoying.
来源:https://stackoverflow.com/questions/428543/is-it-impractical-to-put-an-html-form-into-an-email