I have a form which sends data to be pushed into an access database and I want the contents of the form to be emailed as well using CDONTS. I am able to d all of this in one file but I want to split the two functions between two files, one to post to the database, and another to grab the data and email it. WHat I would like to know is if it is possible to do that because my data does not seem to get to the mailing script and the email I get is blank without any data collected. I have tried to use the Response.Buffer property but it still doesn't seem to work. I'd appreciate some help with this issue please. Below is the code for both scripts. in the order that the server processes the data.
-------------------------
DATABASE UPDATE SCRIPT
-------------------------
<%
Strname = replace(Request("name"),"'","''")
Stremail = replace(Request("email"),"'","''")
Strurl = replace(Request("url"),"'","''")
Strlocation = replace(Request("location"),"'","''")
Strcomments = replace(Request("comments"),"'","''")
dbfile=Server.MapPath("guestbook.mdb")
'Create a Connection Object
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
'
sql_ins="INSERT into comment (name, email, url, location, comments) VALUES " & _
"('" & Strname & "', '" & Stremail & "','" & Strurl & "', '" & Strlocation & "', '" & Strcomments & "') "
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open sql_ins, OBJdbConnection, 3, 3
Response.Redirect("mailer.asp")
%>
---------------
MAILING SCRIPT
---------------
<%
Set objCDO = CreateObject("CDONTS.NewMail")
'Declare variables to be used
Dim objCDO 'CDONTS mailing object
'Set the variables to be used for generating and sending mail
Dim HTML
Set objCDO = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<meta name=""GENERATOR"""
HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
HTML = HTML & "<title>HTMLMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""FFFFFF"">"
HTML = HTML & "<p><strong>"
HTML = HTML & "Mambono.com Guestbook Entry</strong></p>"
HTML = HTML & "<p>"
HTML = HTML & "Wassup " & StrName & "Thank You For Signing My Guestbook, I Appreciate your efforts and Time in Doing that.<br><br>"
HTML = HTML & "<strong>MAMBONO </strong><br><br>"
HTML = HTML & "<a href=http://www.mambono.com><strong>[blue]www.mambono.com </strong></a><br>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'Set the mailing parameters e.g. mail to, body etc...
objCDO.To = Stremail
objCDO.From = "
[email protected] (MAMBONO)"
objCDO.cc = ""
objCDO.Subject = "THANKS"
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Body = HTML
objCDO.Send
%>
<% Set objCDO = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<meta name=""GENERATOR"""
HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
HTML = HTML & "<title>HTMLMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""FFFFFF"">"
HTML = HTML & "<p><strong>"
HTML = HTML & "Mambono.com Guestbook Entry</strong></p>"
HTML = HTML & "<p>"
HTML = HTML & "A new guestbook Entry has been submitted and below are the details submitted<br>"
HTML = HTML & "<br>"
HTML = HTML & "<strong>Name: </strong>" & Strname & "<br>"
HTML = HTML & "<strong>Email: </strong><a href=mailto:"& Stremail &">" & Stremail & "</a><br>"
HTML = HTML & "<strong>URL: </strong><a href="& Strurl &">" & Strurl & "</a><br>"
HTML = HTML & "<strong>Location: </strong>" & Strlocation & "<br>"
HTML = HTML & "<strong>Comments: </strong>" & Strcomments & "<br>"
HTML = HTML & "<br>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = "
[email protected] (MAMBONO)"
objCDO.From = "
[email protected] (GUESTBOOK)"
objCDO.cc = ""
objCDO.Subject = "NEW GUESTBOOK ENTRY"
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Body = HTML
objCDO.Send
set objCDO = nothing
Response.Redirect("view.asp")
%>