email - input text (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


wizard_oz -> email - input text (4/26/2005 9:00:58)

Hi, I would like to create a form that the user is fill in all his details like: name, age, company etc
How do I do it in my code?
.
<%
sub sendMail(fromWho,toWho,subject,body)
 dim myMail
 SET myMail=server.CreateObject("CDONTS.Newmail")
 
 myMail.From=fromWho
 myMail.TO=toWho
 myMail.Subject=Subject
 myMail.Body=Body
 myMail.AttachFile attachf
 myMail.Send
 SET myMail=nothing
end sub

fromWho=TRIM( Request.Form("fromWho"))
toWho=user@userdomain
Subject=TRIM( Request.Form("Subject"))
Body=TRIM( Request.Form("body"))
attachf=Request.Form("attachf")
if toWho<>"" then
 sendMail fromWho,toWho,Subject,body
end if
%>
<body>
<FORM method="POST" action="<%=Request.ServerVariables("SCRIPT_NAME")%>" id=form1 name=form1>
<br>FROM:<INPUT type="text" name="fromWho" size=40>
<br>SUBJECT:<INPUT type="text" name="subject" size=40>
<br><TEXTAREA rows=5 cols=40 name="body"></TEXTAREA>
<br><INPUT type="file" id=file1 name="attachf">
<BR><INPUT type="submit" value="Send Mail" id=submit1 name=submit1>
</FORM>
</body>




Spooky -> RE: email - input text (4/26/2005 14:16:47)

Just a question first - you realise the attach method wont work if the file doesnt exist on the server?

 <%

fromWho=TRIM( Request.Form("fromWho"))
toWho=user@userdomain
Subject=TRIM( Request.Form("Subject"))
Body=TRIM( Request.Form("body"))

Company = Request.form("company")

attachf=Request.Form("attachf")
if toWho<>"" then
dim myMail
SET myMail=server.CreateObject("CDONTS.Newmail")

myMail.From=fromWho
myMail.TO=toWho
myMail.Subject=Subject
myMail.Body=Body & vbrlf & "Company="&Company
myMail.AttachFile attachf
myMail.Send
SET myMail=nothing

end if
%>
<body>
<FORM method="POST" action="<%=Request.ServerVariables("SCRIPT_NAME")%>" id=form1 name=form1>
<br>FROM:<INPUT type="text" name="fromWho" size=40>
<br>SUBJECT:<INPUT type="text" name="subject" size=40>

<br>Company:<INPUT type="text" name="Company" size=40>

<br><TEXTAREA rows=5 cols=40 name="body"></TEXTAREA>
<br><INPUT type="file" id=file1 name="attachf">
<BR><INPUT type="submit" value="Send Mail" id=submit1 name=submit1>
</FORM>
</body> 
 





wizard_oz -> RE: email - input text (4/27/2005 8:27:27)

what do you mean by that? and if it doesn't work, can you help me to get a code that the client fill in the details like name,company,street,etc. and the upload a file from his computer (the file is always a picture)
Thanks, Elen




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625