I have a page that calls information from a form and inserts the info into an email message. I have used CDONTS several times in the past but I can not get it to carbon copy this time whether I use a called variable for the email address or hard code it as you will see below.
here is the code with debug statements intact.:(
any ideas?
action = request("action")
'cusID = request("cusID") coming from firstcontact.asp
spID = request.cookies("spID")
carboncopy2=request("carboncopy")
response.write "Debug carbon copy is " & carboncopy2 &""
sql = "select sname1,sname2,saleemail from salepeople where spID=" & spID
response.write "Debug SQL is " & sql &""
set sale = conn.execute(sql)
salesmanemail = sale("saleemail")
response.write "Debug salesmanemail is " &salesmanemail &""
salesmanname = sale("sname1") & " " & sale("sname2")
response.write "Debug Salesmanname is " & salesmanname & ""
sql = "select fname,lname,email from customers where cusID=" & cusID
response.write "Debug SQL is " & sql &""
set cust = conn.execute(sql)
if not len(cust("email")) > 4 then
customeremail = trim(request.form("customeremail"))
else
customeremail = cust("email")
end if
response.write "Debug customeremail is " & customeremail &""
customername = cust("fname") & " " & cust("lname")
response.write "Debug customername is " & customername &""
cc1 = carboncopy2
'if cc1 = "" then cc1 = " "
response.write "This is the carbon copy field...Debug ccl is: " & carboncopy2 &""
subject = replace(request("subject"),"'","''")
if len(subject) < 2 then subject = "No Subject"
response.write "Debug subject is " & subject &""
textbody = request("textbody2")
response.write "Debug Text Body is " & textbody &""
ctime = dateadd("h",2,time())
response.write "Debug ctime is " &ctime&""
sql = "insert into actiondetail (actdettime,actdetdate,to_name,from_name,spID,cusI D,actID,subject,notes)values"
sql = sql & "(#"&ctime&"#,#"&date()&"#,'"&customername&"','"&s alesmanname&"',"&spID&","&cusID&",6,'"&subject&"', '"&textbody&"')"
response.write "Debug SQL is " & sql
set rs = conn.execute(sql)
Set myMail = CreateObject("CDONTS.NewMail")
myMail.From = salesmanemail
myMail.To = customeremail
myMail.Cc = "
[email protected]"
myMail.Subject = subject
myMail.BodyFormat = 1
myMail.MailFormat = 1
myMail.Body = textbody
myMail.Send
set myMail = nothing