Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 541
  • Last Modified:

how to store the email address in a variable as written by the user in a textbox in ASP?

i don't knew about ASP.Please help me out in this.
i have a variable in which i have statically stored the email address. i want to make it dynamic.

means when the user inputs the email id in the textbox , that email should be stored in a variable.

This all should be done in ASP. this is what i want.
0
designersx
Asked:
designersx
  • 17
  • 8
1 Solution
 
designersxAuthor Commented:
please, i request u to give me the full code of this.

yogesh
0
 
designersxAuthor Commented:
to run asp in a browser i need to install IIS for which i need Windows XP CD but on the internet ,we can find the important files needed to install IIS on windows XP.

please give me quickly these files so that i can install IIS on my windows.

kind regads
yogesh

0
 
designersxAuthor Commented:
able to install IIS, no probs
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
dosthCommented:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form name="EmailForm" method="Post" action="test.asp">
Email: <input type="text" name="Email" size="50">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

assume that above is the page

you can get the user input like this

<%

Dim strEmail
strEmail = Request.form("Email")
Response.Write(strEmail)

%>
0
 
Wayne BarronCommented:
designersx

A lot of wants and not enough information.

Can you better explain what it is that you are wanting to do?

Also.
To make sure that IIS is installed properly and that you can run .asp pages.
Open Notepad and add this into it

<%
response.write("Hello World, I have arrived")
%>

Save the file as       hello.asp
Making sure that the   File Type is set to [all]
Save it to your Web Directory, which is default:
C:\InetPub\wwwroot\

Now from your browser, type in.....
http://localhost/hello.asp

If you get a 500 error, that means that it is not working.
If you see           Hello World, I have arrived
Written to the page, then it is working, and we will go onto the next step.

=========
Next Step.
What are you wanting to do exactly.
Please be as specific as possible.
Let me know exactly what it is that you are wanting to accomplish.

Carrzkiss
0
 
designersxAuthor Commented:
i have installed IIS. when we send email , there are 4 things in that,
1) to
2) subject
3) from
4) body

from is the email id of visitor/ user who comes to our site.
so i want to make from variable dynamic.

in the below file [contactus.asp], please see    sEmail=Request.QueryString("Email")     this line of code

sFromEmail = "sEmail"   when i write sFromEmail ="admin@gmail.com" means static , it works but from variable is always dynamic while sending the form. and when i write sFromEmail = "sEmail" , error comes :- domain error 500. this email and other details are stored in database.
[contactus.htm]
 
<form method="post" name="contact_form" action="contactus.asp">
          <table border="0" cellpadding="0" cellspacing="0" width="99%">
            <tbody>
              <tr>
                <td colspan="2" align="left" valign="bottom"><table border="0" bordercolor="#3B5B80" cellpadding="0" cellspacing="0" width="100%">
                    <tbody>
                      <tr>
                        <td><table border="0" cellpadding="0" cellspacing="0" width="99%">
                          <body>
                              <td width="46%" height="35" align="left"><font face="Verdana" size="2"><font color="#000000" class="Utxt1"> Name</font><font color="#f74444" size="1" face="Verdana" class="Utxt4">*</font></font></td>
                              <td width="54%" align="left"><div align="left"> <font face="verdana,arial,helvetica"><small>
                                  <input name="Name" type="text" class="Utxt1" size="40">
                              </small></font> </div></td>
                          </tr>
                           <td align="left" height="35" valign="middle"><font face="Verdana" size="2"><font color="#000000" class="Utxt1"> 
                              E-mail</font><font color="#f74444" size="1" face="Verdana" class="Utxt4">*</font></font></td>
                            <td align="left" valign="middle"><div align="left"> <small><font face="verdana,arial,helvetica">
                                <input name="Email" type="text" class="Utxt1" size="40">
                            </font></small> </div></td>
                          </tr>
                          
                            <td align="left" height="35" valign="middle"><font color="#000000" size="2" face="Verdana" class="Utxt1">Phone</font></td>
                            <td align="left" valign="middle"><div align="left"> <small><font face="verdana,arial,helvetica">
                                <input name="Phone" type="text" class="Utxt1" size="40">
                            </font></small> </div></td>
                          </tr>
                          
                            <td align="left" height="35" valign="middle"><font face="Verdana" size="2"><font color="#000000" class="Utxt1">Branch</font><font color="#f74444" size="1" face="Verdana" class="Utxt4">*</font></font></td>
                            <td align="left" valign="middle"><font face="Verdana" size="1">
                              <select name="branch" size="1" class="Utxt1">
                                <option value="" selected="selected">-----</option>
                                <option value="1">Bayswater</option>
                                <option value="2">Chelsea Heights</option>
                                <option value="3">Clayton</option>
                                <option value="4">Fitzroy</option>
                                <option value="5">Footscray</option>
                                <option value="6">Frankston</option>
                                <option value="7">Geelong</option>
								<option value="8">Heatherton</option>
                                <option value="9">Port Melbourne</option>
								<option value="11">Thomastown</option>
                                <option value="10">Tullamarine</option>
                              </select>
                            </font></td>
                          </tr>
                          
                            <td align="left" height="35" valign="middle"><font color="#000000" size="2" face="Verdana" class="Utxt1">When do you need storage?</font></td>
                            <td align="left" valign="middle"><small><font face="verdana,arial,helvetica">
                              <input name="whenyns" type="text" class="Utxt1" size="40">
                            </font></small></td>
                          </tr>
                          
                            <td align="left" height="35" valign="middle"><font color="#000000" size="2" face="Verdana" class="Utxt1">Please describe what you have to store? <br>
                              (eg 3 bedroom house)</font></td>
                            <td align="left" valign="middle"><small><font face="verdana,arial,helvetica">
                              <input name="howmuch" type="text" class="Utxt1" size="40">
                            </font></small></td>
                          </tr>
                        </table></td>
                      </tr>
                    </tbody>
                </table></td>
              </tr>
              <tr>
                <td width="40%" height="35" align="left" valign="bottom"><font face="Verdana" size="2"><font color="#000000" class="Utxt2">Enquiry</font><font color="#f74444" size="1" face="Verdana" class="Utxt4">*</font></font><font color="#000000" face="Verdana" size="2">&nbsp; </font></td>
                <td align="left" valign="bottom" width="65%"></td>
              </tr>
              <tr>
                <td colspan="2" align="left" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tbody>
                      <tr>
                        <td height="138"><table border="0" cellpadding="0" cellspacing="0" width="100%">
                          <tbody>
                          <td width="98%" height="152" align="left" valign="top"><div align="left">
                                  <p><font face="verdana,arial,helvetica"><small>
                                  <textarea name="Enquiry" cols="100" rows="8" wrap="soft" class="Utxt1"></textarea>
                                  </small></font> </p>
                                <p> </p>
                              </div></td>
                          </tr>
                        </table></td>
                      </tr>
                </table></td>
              </tr>
              <tr>
                <td align="left" width="40%"></td>
                <td width="65%"><input name="Submit" type="submit" class="Utxt1" id="Submit" value="Submit"></td>
              </tr>
            </tbody>
          </table>
		  <input type="hidden" name="submitted" value="true">
        </form>
 
 
[contactus.asp]
 
<%
	Dim errMsgs
	errMsgs = ""
	OpenDataConnection
	
	IF GetParam("submitted") = "true" THEN
		sName = GetParam("Name")
		sEmail=Request.QueryString("Email")
		Response.Write( fname & )
		sPhone = GetParam("Phone")
		iBranchID = GetParam("branch")
		sWhenyns = GetParam("whenyns")
		sHowmuch = GetParam("howmuch")
		sEnquiry = GetParam("Enquiry")
		
		strEmailTemplate = Server.MapPath("secure\templates\email-contactus.html")
		
		ReadFile strEmailTemplate, sContent
		sContent = Replace(sContent, "{{name}}", TRIM(sName))
		sContent = Replace(sContent, "{{email}}", TRIM(sEmail))
		sContent = Replace(sContent, "{{phone}}", TRIM(sPhone))
		sContent = Replace(sContent, "{{branch}}", getBranchName(iBranchID))
		sContent = Replace(sContent, "{{whenyns}}", TRIM(swhenyns))
		sContent = Replace(sContent, "{{howmuch}}", TRIM(sHowmuch))
		sContent = Replace(sContent, "{{enquiry}}", TRIM(sEnquiry))
		sContent = Replace(sContent, "{{ipaddress}}", Request.ServerVariables("REMOTE_HOST"))
		
		sFromName = "Fry's Self Storage Admin"
		sFromEmail = "sEmail"
		sSubject = "Fry's Self Storage Enquiry"
		sTo = getBranchEmail(iBranchID)
	
		SendEmail sFromName, sFromEmail, sTo,"", sSubject, sContent
	ELSE
		Response.Redirect "contactus.html"		
	END IF
	CloseDataConnection
%>

Open in new window

0
 
designersxAuthor Commented:
hello dosth, u have done right but would u see the code here and what i am trying to do is giving me error.

sFromEmail = "sEmail"   error is here. mail concept is working the only thing is that from variable should not be static.   sEmail is the email when any user comes to our site and registers,  then his email should come in the from variable.

kind regards
yogesh
0
 
Wayne BarronCommented:
Try this,
It is not a Querystring that you needed but a   .form

Carrzkiss
<%
	Dim errMsgs
	errMsgs = ""
	OpenDataConnection
	
	IF GetParam("submitted") = "true" THEN
		sName = GetParam("Name")
		sEmail=Request.Form("Email")
		Response.Write("fname")
		sPhone = GetParam("Phone")
		iBranchID = GetParam("branch")
		sWhenyns = GetParam("whenyns")
		sHowmuch = GetParam("howmuch")
		sEnquiry = GetParam("Enquiry")
		
		strEmailTemplate = Server.MapPath("secure\templates\email-contactus.html")
		
		ReadFile strEmailTemplate, sContent
		sContent = Replace(sContent, "{{name}}", TRIM(sName))
		sContent = Replace(sContent, "{{email}}", TRIM(sEmail))
		sContent = Replace(sContent, "{{phone}}", TRIM(sPhone))
		sContent = Replace(sContent, "{{branch}}", getBranchName(iBranchID))
		sContent = Replace(sContent, "{{whenyns}}", TRIM(swhenyns))
		sContent = Replace(sContent, "{{howmuch}}", TRIM(sHowmuch))
		sContent = Replace(sContent, "{{enquiry}}", TRIM(sEnquiry))
		sContent = Replace(sContent, "{{ipaddress}}", Request.ServerVariables("REMOTE_HOST"))
		
		sFromName = "Fry's Self Storage Admin"
		sFromEmail = "sEmail"
		sSubject = "Fry's Self Storage Enquiry"
		sTo = getBranchEmail(iBranchID)
	
		SendEmail sFromName, sFromEmail, sTo,"", sSubject, sContent
	ELSE
		Response.Redirect "contactus.html"		
	END IF
	CloseDataConnection
%>

Open in new window

0
 
designersxAuthor Commented:
i  am getting this error

sFromEmail

Persits.MailSender.4 error '800a0006'

501 Your domain does not seem to be valid. Could not find MX record for your domain.

/common.asp, line 286
0
 
Wayne BarronCommented:
Make sure that you type out the email address correctly and in the correct format

you@domain.com
0
 
designersxAuthor Commented:
this error is coming

      
Microsoft VBScript compilation  error '800a03ea'

Syntax error

/contactus.asp, line 10

Response.Write( fname & )
------------------------^
0
 
Wayne BarronCommented:
did you use the code that I supplied?
Please look at it, and copy what I have in the code.
You will see what some of the things are changed.

Please look at my code...

Carrzkiss
0
 
designersxAuthor Commented:
i have tried ur complete sir,

this error is there.

fname

Persits.MailSender.4 error '800a0006'

501 Your domain does not seem to be valid. Could not find MX record for your domain.

/common.asp, line 286
0
 
designersxAuthor Commented:
should i give u common.asp file?
0
 
designersxAuthor Commented:
complete code sir

kind regards,
yogi
0
 
Wayne BarronCommented:
I will be unable to test it as I do not have the same mail component as you do.

Do this please

Response.Write( fname & )
change to
Response.Write("fname")

Let me know what happens?
0
 
designersxAuthor Commented:
i mean to say sorry i misspelled above, i used Ur complete code sir.
0
 
Wayne BarronCommented:
never mind and what I sayed to change...
0
 
Wayne BarronCommented:
when you run the code with everything the way you had it, EXCEPT but this
sEmail=Request.QueryString("Email")
Changed to
sEmail=Request.Form("Email")

What do you get? What happens?
0
 
designersxAuthor Commented:
i changed and after changing this error is coming,

fname
Persits.MailSender.4 error '800a0006'
501 Your domain does not seem to be valid. Could not find MX record for your domain.
/common.asp, line 286
0
 
designersxAuthor Commented:
ok sorry i have not checked and told u the result, just hold on i am checking sir. sorry for that
0
 
designersxAuthor Commented:
now see ,

when i only wrtie form instead of query string then, this error comes

Microsoft VBScript compilation  error '800a03ea'
Syntax error
/contactus.asp, line 10
Response.Write( fname & )
------------------------^

and when i write form and do "fname" instead of fname &

this error comes
fname
Persits.MailSender.4 error '800a0006'
501 Your domain does not seem to be valid. Could not find MX record for your domain.
/common.asp, line 286

this is the status before reading reading ur latest comment.

let me read ur last comment and then i let u know .

ok sir.
0
 
designersxAuthor Commented:
i am sending u common.asp file and contactus.asp file.

convert the extension from .txt to .asp files , it was to upload these files.

yogesh
common.txt
contactus.txt
0
 
designersxAuthor Commented:
i have made a simple program, but there is error coming at the same point when i have uploaded that on the server. check ou the link,

http://designers-x.com/projects/projects/send_mail_asp/2/test.asp

why there is a error at this line, myMail.Send

error is: -

CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
/projects/projects/send_mail_asp/2/test.asp, line 7
[test.asp]
 
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="yogeshban@gmail.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>

Open in new window

0
 
Wayne BarronCommented:
Also, I see that you have changed in your mail component from what you had before.
This error is caused of several reasons:
You cannot relay mail through your mail server (Which is most likely the issue)
As I see here in you      myMail.To="yogeshban@gmail.com"
Meaning that you are sending to someone.

If you want help with this, then that is another issue.
You have several different things going on here.
So.

Open up a new post for this issue.
And either myself or someone else will assist you with the mail issue.

----------
We need to get the mail issue fixed, in order to fix this post's issue.

So, lets get this all wrapped up here OK?

0
 
designersxAuthor Commented:
yes sir, i have asked a new question for mail issue with asp?

problems are coming with SMtp server   or  transportation failure  like this.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 17
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now