It means that I cannot reply directly without cutting and pasting the email address from the form....
How can I change this?
It may be something to do with this..
<input type="hidden" name="from" value="www.myurl.co.uk">
I am using html, asp and cgi.
Any help would be greatly appreciated.
Cheers
F
For example, in ASP using CDONTS:
set mailobj = server.CreateObject("CDONTS.Newmail")
mailobj.From = FromEmailAddress
Where the variable FromEmailAddress is got from the form.
HTH
I use a free PHP script for email forms. If the form has a field for the person's name and email address, the email I would receive has 'Joe Bloggs <joe@bloggs.com>' in the From field.
I'm no code wizard but your form script needs to be able to reference the form fields (variables) that your user inputs into each text box, which are then passed through to the form processing script.
It is worth spending some time finding a secure script as they are commonly exploited by hackers :).
The code for the form is very basic - html really as host provides the cgi-bin/sendform.pl instructions.
This is the bones of the code that I have used:-
<form method="post" action="http://www.host.co.uk/cgi-bin/sendform.pl">
<input type="hidden" name="to" value="info@myurl.com">
<input type="hidden" name="from" value="www.myurl.com">
<input type="hidden" name="subject" value="Enquiry">
<input type="hidden" name="successpage" value="http://www.myurl.com/thankyou.htm">
So, not too sure what I can do - host advised that I need extra coding but not very helpful when you don't know much about coding!
Again any help with very basic instructions would be great.
many thanks again
feemgh
1) Figure out where the "from" field is getting its value.
You said you get emails with from = info@myurl.co.uk
so you have to see where is value "info@myurl.co.uk" getting set.
2) If you are able to figure out that .. you need to make an appropriate change there ..
that change will be some thing like
$from = $from_value_entered_by_joe_user; //value entered in form
<edit typo>
Does that mean that I should change this line of code...
<input type="hidden" name="from" value="www.myurl.com">
The problem is that the host provides the scripts - so does this limit the possibilities to alter the code?
Sorry to be so niaive .... just fumbling about in the dark here....I know nothing about perl....
Cheers
feemgh
Here is all the code for my form...
If you can help I would be very grateful...thanks in anticipation...
feemgh
------------------------------------------------------------
<form name="enquiries" method="post" action="http://www.host.co.uk/cgi-bin/sendform.pl" onSubmit="MM_validateForm('forename','','R','surname','','R','email','','R','telephone','','R','referrer','','R');return document.MM_returnValue">
<input type="hidden" name="to" value="info@myurl.co.uk">
<input type="hidden" name="from" value="www.myurl.co.uk">
<input type="hidden" name="subject" value="Enquiry">
<input type="hidden" name="successpage" value="http://www.myurl.co.uk/thankyou.html">
<center>
<b>E-mail:</b>
<input type="text" name="from" size="35" maxlength="50">
[edited by: jatar_k at 3:39 pm (utc) on June 24, 2003]
[edit reason] removed all unnecessary code [/edit]
<input type="text" name="from" size="35" maxlength="50">
So this should be setting up a variable "$from" when the form is submitted to this script.
You need to use it where email is being sent in your script.
PS: If it still causes a problem then
>><input type="hidden" name="from" value="www.myurl.co.uk">
This looks like an extra line which should not be there .. two form fields having same name "from" is not a good idea .. though I guess it should not be causing problem in this case because it appears first .. but try deleting this line any way.
From your post I tried it in my own scripts, and it worked like a charm. (I didn'T even know about this, as it'S basically faking the FROM info) Forward, replies and all work fine now.
PS also try to cut down on those font tags. and next time you post a form in a forum, please take the time and remove the formatting codes, thanks.
SN
<input type="hidden" name="from" value="www.myurl.co.uk">
and swapped the email in this line to "from"
<input type="text" name="email" size="35" maxlength="50">
a box was added to the top of the form that I did not want....
Is that happening on your screen?
It also did not work i.e. I am still waiting for the form to arrive 1 hour later!
thanks
feemgh
PS Sorry about the length of the code - I did spend ages trying to make it look neater but never thought to take out <font> tags etc ...wil next time...!
Jaski....a bit of your solution and a bit of Killroy's solutions have worked.
I have removed this line...
<input type="hidden" name="from" value="www.myurl.co.uk">
and swapped "from" for email in this section....i.e.
<input type="text" name="email" size="35" maxlength="50">
And it seems to work.....
FANTASTIC
Many thanks all for your patience and persistence.
feemgh
<input type="text" name="from" size="35" maxlength="50">
should be:
<input type="text" name="email" size="35" maxlength="50">
The hidden vs not hidden is a red herring. Whether a field is hidden or not makes no difference to how it is processed by the form cgi.
To test it, cut down the form to the bare minimum as follows:
<form action="http://http://www.host.co.uk/cgi-bin/sendform.pl" method=post>
<input type="hidden" name="to" value="info@myurl.com">
<input type="hidden" name="from" value="A potential customer">
<input name="email">
<input type="hidden" name="subject" value="Testing my email form">
<input type="hidden" name="successpage" value="http://www.myurl.com/thankyou.htm">
<input type=submit>
</form>
But really, the best way to debug this would be to look at the perl script and see what field it wants for the reply-to address, rather than try to guess. Can you download it from your ISP?
Shawn
[added: Whoops... I walked away from my screen for 45 minutes... I see you have solved it, so my post is a bit reduntant. Well done for solving it anyway. You can leave the hidden 'from' line in. It will probably then show you that the 'sender' is your website. i.e. the text name of the sender, not the sender's email address.]
I have had a look at the new host providers form_to_email scripts and these are some of the relevant variables:-
from: When the email is received by the intended recipient, the mail is given as being from this address. Without this line, the script defaults to "sendform@ednet.co.uk".
mandatory: This is a list of fields that the user MUSTfill in for the form submission to work. This list should be comma separated only. Without this line, the script has no mandatory fields.
email_as_from: If this is set to "yes" in the form, you can create a form field named emailfield of the form and use the content of that field as the fromaddress in the email sent out. This only works if the form has an emailfield.
I think I should maybe use the last option to do things properly? The problem is that we have switched providers so that is why matters are complicated plus I don't know much about the coding....
If I add
<input type="hidden" name="email_as_from" value="yes">
and then add
<input type="text" name="emailfield" size="35" maxlength="50">
Is this what I should be doing so that it works properly?
Help please!
Thanks
feemgh
You use the 'mandatory' field like this:
<input type="hidden" name="mandatory" value="surname,telephone">
<input type="hidden" name="errorpage" value="url of your error page">
Then the 'surname' and 'telephone' fields will be mandatory, and if the user does not fill them in, the error page will be shown instead of the thankyou.htm page.
Shawn
Well it has been resolved but it is not in keeping with what the ISP details say....
I am not sure if I have interpreted it correctly....not sure if what I posted in last section will work. I don't see how the second bit of code (emailfield) ties in with the first bit of code (email)?
Sorry for being so dim....
Cheers
feemgh
Sometimes I might post with a tone that portrays more confidence than I should. Other times I post with a humble tone even though I am confident I am correct, just to see what other people think. Just depends on what I am trying to achieve, and my mood. I am sure others are the same. So always be critical ;)
Shawn