# HTML experts: Help me with an anonymous mail form?

**URL:** https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279
**Category:** Factual Questions
**Created:** [January 13, 2004, 6:45pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279 "2004-01-13T18:45:01Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Beadalin](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Beadalin](https://boards.straightdope.com/u/Beadalin)
#### Post date: [January 13, 2004, 6:45pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279/1 "2004-01-13T18:45:01Z")

</div>

I could really use some help creating a mailform for a site I’m building. My company is announcing some changes, and I’m building a website to support the rollout of the changes. We’d like to allow people to submit questions. Easy enough. But, we also want to allow them to be able to choose whether to identify themselves or to remain anonymous. I built a form that works just fine if people choose to identify themselves, but it fails completely. Arrgh!

Do any of you know what I can do to make this thing go? I’d really appreciate it! Here’s the relevant code as it stands now:

> [@](#):
>
> \<form name=“test\_email” method=“post” action=“[http://www.mycompany.com/open\_mailer.asp](http://www.mycompany.com/open_mailer.asp)”\>  
> \<!-- MANDATORY FORM FIELDS START–\>  
> \<input type=“hidden” name=“send\_to” [value="me@mycompany.com](mailto:value=%22me@mycompany.com)" /\>  
> \<input type=“hidden” name=“subject” value=“Question” /\>  
> \<input type=“hidden” name=“redirect” value=“[http://www.mycompany.com/organization/thank\_you.htm](http://www.mycompany.com/organization/thank_you.htm)” /\>  
> \<!-- MANDATORY FORM FIELDS END–\>  
> \<table width=“400” border=“0” cellspacing=“2” cellpadding=“5” bgcolor="#FFFFFF" align=“center”\>  
> \<tr valign=“middle”\>  
> \<td\>  
> \<div align=“right”\>  
> \<input type=“radio” name=“Anonymous” value=“Yes”\>  
> \</div\>  
> \</td\>  
> \<td\>\<span class=“copy”\>I prefer to remain anonymous\</span\>\</td\>  
> \</tr\>  
> \<tr valign=“middle”\>  
> \<td\>  
> \<div align=“right”\>  
> \<input type=“radio” name=“Anonymous” value=“No”\>  
> \</div\>  
> \</td\>  
> \<td\>\<span class=“copy”\>You may contact me directly to answer  
> my question _\</span\>\</td\>  
> \</tr\>  
> \<tr valign=“middle”\>  
> \<td\>&nbsp;\</td\>  
> \<td\>\<span class=“copy”\>_ If you would like a direct response,  
> you’ll need to supply your name and email address so that  
> we can reach you.\</span\>\</td\>  
> \</tr\>  
> \<tr valign=“middle”\>  
> \<td\>  
> \<div align=“right”\>\<span class=“copy”\>Your name:\</span\> \</div\>  
> \</td\>  
> \<td\>  
> \<input type=“text” name=“name” size=“35” maxlength=100 /\>  
> \</td\>  
> \</tr\>  
> \<tr valign=“middle”\>  
> \<td\>  
> \<div align=“right”\>\<span class=“copy”\>Email&nbsp;address:\</span\>  
> \</div\>  
> \</td\>  
> \<td\>  
> \<input type=“text” name=“from\_who” size=“35” maxlength=“100”/\>  
> \</td\>  
> \</tr\>  
> \<tr\>  
> \<td colspan=“2”\>  
> \<div align=“left”\>\<br\>  
> \<span class=“subhead”\>Question:\<br\>  
> \<textarea name=“Question” cols=“40” rows=“5”\>\</textarea\>  
> \</span\>\</div\>  
> \</td\>  
> \</tr\>  
> \<tr\>  
> \<td colspan=“2”\>  
> \<div align=“center”\>  
> \<input type=“submit” name=“Submit” value=“Submit”\>  
> \<br\>  
> &nbsp; \</div\>  
> \</td\>  
> \</tr\>  
> \</table\>  
> \</form\>

---

<div class="post-metadata">

### Author: ![Beadalin](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Beadalin](https://boards.straightdope.com/u/Beadalin)
#### Post date: [January 13, 2004, 6:50pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279/2 "2004-01-13T18:50:39Z")

</div>

Sorry, I meant to say that the form I built that works just fine if people choose to identify themselves, but it fails completely **if they choose to remain anonymous**. Kind of key!

---

<div class="post-metadata">

### Author: ![DoubleJ](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@DoubleJ](https://boards.straightdope.com/u/DoubleJ)
#### Post date: [January 13, 2004, 6:57pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279/3 "2004-01-13T18:57:35Z")

</div>

Well, there’s nothing in the HTML block you provided that would cause any sort of problem. What kind of error are you getting? Is it a javascript error from someplace else on the page, or an ASP error from the page you go to when the form submits?

On preview, it sounds like a script somewhere doesn’t know that the e-mail field is optional, but without more information I can’t say for sure.

---

<div class="post-metadata">

### Author: ![micco](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@micco](https://boards.straightdope.com/u/micco)
#### Post date: [January 13, 2004, 7:56pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279/4 "2004-01-13T19:56:38Z")

</div>

As **DoubleJ** said, there’s nothing in the HTML to help. It’s likely that your error is in the open\_mailer.asp script you’re submitting the form to. Given the headers of the form, that’s probably a generic mailer that dumps the inputs to an email. In many cases, these are configured to use the input email address as the “From” address for the email, so your recipient gets an email which appears to be from the person who submitted the form. This facilitates replies, but as you’ve found the mailer will fail if the email address is blank and the mailer won’t accept a null From field. If this is the problem, you should note that this is also very insecure (using a user input value as the from address for an email header). You should hard-code an email address to be used as the From address, probably a support address for your website so if the mail sent by the form bounces, you’ll get the info.

To make this happen, you could either edit the open\_mailer.asp script to hard-code a From address or you could change the HTML form so the “from\_who” field is a hidden input with a preset value and the user inputs their own email in a new field, say “from\_user”. The former (editing the ASP) would be better because someone could still use your mailer to forge addresses by using an altered HTML form if the From address is set in a hidden input.

---

<div class="post-metadata">

### Author: ![Beadalin](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Beadalin](https://boards.straightdope.com/u/Beadalin)
#### Post date: [January 13, 2004, 8:11pm UTC](https://boards.straightdope.com/t/html-experts-help-me-with-an-anonymous-mail-form/224279/5 "2004-01-13T20:11:31Z")

</div>

> [@](#):
>
> _Originally posted by **micco** :_  
> In many cases, these are configured to use the input email address as the “From” address for the email, so your recipient gets an email which appears to be from the person who submitted the form. This facilitates replies, but as you’ve found the mailer will fail if the email address is blank and the mailer won’t accept a null From field.

That’s exactly it! And I hadn’t even considered hard-coding an email address to avoid it as you suggested. If I was a cartoon, there would be a giant lightbulb over my head right now. Excellent!

As it happens, I don’t have access to the open\_mailer.asp script, so I’ll have to go the HTML route. I think it will be OK, though, because the audience for this is limited to employees only and will be accessible by employees only.
