Click to See Complete Forum and Search --> : Automated Email Don't Have A Clue
Calmaris
02-07-2003, 12:52 PM
REMEMBER WHEN YOU REGISTERED YOU GOT AN AUTO RESPONSE EMAIL, CAN SOMEONE HELP ME WITH HOW TO DO IT, SOME EXAMPLE CODE WOULD BE GREAT TOO, THE USER WILL REGISTER AND THE FORM CONTENTS WILL BE INSERTED INTO AN ACCESS DATABASE AND I WANT AN AUTO RESPONSE EMAIL SENT TO THEM BASED ON THE EMAIL ADDRESS THEY FILLED OUT ON THE FORM WHICH WAS ON THE LIST.
Ribeyed
02-07-2003, 05:28 PM
hi,
hope this helps:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
'------------------this is an if statment for postback--------------------
val = request.form("val")
if val = "" then
'-----------------this is the form--------------------------------------
%>
<form action="thankyou.asp" method="get">
<table width="90%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>Name:</td>
<td><input name="t1" type="text" id="t1"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="t2" type="text" id="t2"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="Password" type="password" id="Password"></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="sl" id="sl"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">
<input name="val" type="hidden" id="val" value="yes"></td>
</tr>
</table>
</form>
<%
'----------------if the form has been submitted to its self then run this code-------------------
else
'--------------------request the form elements and write to variables----------------------
t1 = Request.Form("t1")
t2 = Request.Form("t2")
st = Request.Form("s1")
yourpassword = request.form("password")
Dim ObjMail
'-------------------setup the CDONTS email object-------------------------------------
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
'------------------------Set the email elements------------------------------
ObjMail.To = ""&t2&""
ObjMail.CC = ""&t2&""
ObjMail.From = "mybox@aol.com"
ObjMail.Subject = "You have registered"
thebody = "Name:"&t1&"" & vbcrlf
'----------------create the body of the message------------------------
thebody = thebody & "Email: "&t2&"" & vbclf
thebody = thebody & "Subject: "&t3&""
ObjMail.Body = thebody
'----------------------send the message-----------------------------------
ObjMail.Send
Set ObjMail = Nothing
'---------------------insert the information intot he database------------------------
sqltext = "INSERT INTO tblMembers (MemberName, MemberPassword "
sqltext = sqltext & " VALUES ("&t1&", "&yourpassword&")"
set RS = yourdatasource.Execute(sqltext)
set RS = nothing
'---------------------insert your thankyou message here------------------
%>
<table width="90%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>Thank you <%=t1%></td>
</tr>
</table>
<%
'----------------------end if the if statement----------------------------
end if
%>
Calmaris
02-07-2003, 08:18 PM
Hey thanks alot, I really appreciate the help on this. LoL I would love to try it but my SQL server got the slammer virus and I have to reinstall it and reconfigure a bunch of crap. I'll post another thread if I run into any trouble.
Thanks