PDA

View Full Version : Mail Form


klmgb
Jan 27, 2006, 09:42 PM
I have a mail form from my webhost. I have modified to an extent. The only thing I can't figure out is this -- I want to take out thr from line. I can take it out to where it doesn't show up but when I try to send an email I get an error that says check the senders address. I do not want the sender to have to input an address. Is this possible?

This is what I used

Thanks for the help

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="GENERATOR" content="IBM WebSphere Studio">
<title>Keith</title>
</head>
<body>
<p>Please Fill out the form below and press "Send Email" to
submit:</p>
<form action="/cgi-bin/readSend.cgi" method="post">
<table border="0">
<tbody>
<tr>
<td align="right" width="51">To:</td>
<td>&nbsp;
Keith
<!-- CHANGE THE "VALUE" TAG BELOW TO EDIT OR ADD RECIPIENT --><input
name="TO" value="my email address" type="hidden">
</td>
</tr>
<tr>
<td align="right" width="51">From:</td>
<td><input size="67" name="FROM"
type="text"></td>
</tr>
<tr>
<td align="right" width="51">Subject:</td>
<td><input size="67" name="SUBJECT"
type="text"></td>
</tr>
<tr>
<td colspan="2"><textarea rows="15"
cols="80" name="BODY" wrap="virtual"></textarea></td>
</tr>
<tr>
<td width="51"></td>
<td align="right"><input name="submit"
value="Send Email" type="submit"><input
name="clear" value="Clear Fields" type="reset"></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>

ScottGem
Jan 28, 2006, 07:19 AM
I don't believe its possible. E-mail has to have a senders address even if it's a spoofed one (which I do not advocate doing).

Something you might consider is to create a default address on one of the free sites and then default the From address to that.

LTheobald
Jan 31, 2006, 04:56 AM
Change the from part from:

<input size="67" name="FROM" type="text"> To either:

<input name="FROM" type="hidden" value="[email protected]" /> That will completely hide the from text box. Or you could use...

<input size="67" name="FROM" type="text" value="[email protected]" readonly />
That will just make the from field readonly so people can see it but not change it. You could then use some CSS to make it look like normal text.

In the above code just make sure you change the value attribute to where you want the email to be set as being sent from.

ScottGem
Jan 31, 2006, 06:54 AM
LT,

I'm curious, in your code, I understand it will hide the FROM box on the form, but will that mean the recipient won't see a FROM?

Scott<>

LTheobald
Jan 31, 2006, 08:16 AM
Scott,

The user won't see a from field on the page they are using but there will be a from header on the email. The from field is there, it's just hidden (viewing the HTML source would show it to you). So the CGI script Klmgb is using will be able to find the from address still and use that when sending the email.

When I read the question, I thought Klmgb wanted to have an email form that didn't give the user an option of specifying a from address. So for example, it could be a form where a web page user could send something to themselves (e.g. product details). All you would really want the user to have to enter is a to address and possibly a subject and a message to be appended to whatever they are requesting. A from field wouldn't be required on the page as it would always be the same - e.g. an email for the website they are visiting. Kind of the reverse of a "contact me" form where you wouldn't need a to field, just a from and message field.

klmgb
Jan 31, 2006, 08:22 AM
Let me start by saying -- Remember I am verrryyy new at this.

Lt - When I changed the code to read <input name="FROM" type="hidden" value="[email protected]" /> and uploaded to my server, when I call up the email from my website it still shows the from block. But I saved it to my computer and opened the form with IE, it doesn't show up. I can only assume that it has something to do with how my ISP handles this function, which I also assume is somehow imdedded in this code <form action="/cgi-bin/readSend.cgi" method="post">. That I probably can't get to with my limited knowledge.
What I am attempting is to not show any email addresses. But I notice that after I send an email from the website a new message pops up that says "Thank You, an email has been sent to [email protected], which is not written in to my form.

Thanks

klmgb
Jan 31, 2006, 08:24 AM
BTW, this a very primitive family website

ScottGem
Jan 31, 2006, 08:54 AM
LT thanks. My assumption was that he just didn't want to have the user fill in a FROM and that the content of the form would tell him who was responding. Unless he's taking an anonymous survey. In any case, the idea (which I had and you showed how to do) of using a default address, whether hidden or not should be workable.

LTheobald
Jan 31, 2006, 10:16 AM
Lt - When I changed the code to read <input name="FROM" type="hidden" value="[email protected]" /> and uploaded to my server, when I call up the email from my website it still shows the from block. But I saved it to my computer and opened the form with IE, it doesn't show up.

I'm guessing this is probably because you were viewing the version of your page in your cache (temporary internet files). Try loading up the site and pressing CTRL+F5. This will do a complete refresh of the page and you should be able to see the change.

As for the username appearing after the script has ran. That will be in the CGI script you are calling (the one specified in the <form action=""> bit). If you are feeling brave open the CGI file, search for the text "An email has been sent to", and delete it so that just the quotes are left. Alternatively post it here and we can tell you what to edit.

Quick note though. There's a very basic way of sending the contents of forms in emails. If you just have a form like below:


<form action="mailto:[email protected]" method="post" enctype="text/plain">
<!-- Text boxes etc. here -->
<input type="submit" name="submit" />
</form>

This will create an email containing any responses and place it in your emails program outbox (e.g. Outlook Express) so that it's ready to send next time you check your email. The only problem with this is that it doesn't work for those that only use webmail (e.g. Hotmail) on their computer. Also it may not work in older browsers. But if you know your family will be using Internet Explorer and Outlook Express, it's a quick and simple solution.