PDA

View Full Version : cdonts email different agreements based on product purchased


details
07-17-2002, 12:47 AM
I have CDonts running for order confirmation.
I am requesting strAccessories, strDWDT,strNew,strExisting and strDWAemail from a form on another page. Basically letting the CDonts no what agreement to send. However if a user orders 2 things with 2 different agreements it sends last one. If the user orders 2 things that have the same agreement is shows nothings. How can I fix this? Can the line in CDONTS "strBody = dirwaytext" be rewritten to strBody = dirwaytext and accessories

<%
strAccessories = Request.form("strAccessories")
strDWDT = Request.form("strDWDT")
strNew = Request.form("strNew")
strExisting = Request.form("strExisting")
strDWAemail = Request.form("strDWAemail")

Dim objMsg, strFrom, strBcc, strTo, strSubject, strBody,lngImportance,dirwaytext

if strDWDT= "yes" then
dirwaytext = "Show this agreement"
end if

if strNew= "yes" then
dirwaytext = "Show this agreement"
end if

if strExisting= "yes" then
dirwaytext = "Show this agreement"
end if

if strDWAemail= "yes" then
dirwaytext = "Show this agreement"
end if

if strAccessories = "yes" then
accessories = "Show this agreement"
end if

strFrom = "sales@yourdomain.com"
strTo = Trim(Request.Form("strEmail"))
strBcc = "sales@yourdomain.com"
strSubject = "Thanks for Shopping With Us"
strBody = dirwaytext
lngImportance = 1

Set objMsg = Server.CreateObject("CDONTS.NewMail")

objMsg.From = strFrom
objMsg.To = strTo
objMsg.Bcc = strBcc
objMsg.Subject = strSubject
objMsg.Body = strBody
objMsg.Importance = lngImportance
objMsg.Send

Set objMsg = Nothing

%>

:confused: :confused:

whammy
07-17-2002, 02:09 AM
The problem is that you have the same variable for each thing... try instead doing something like:

if strDWAemail= "yes" then
dirwaytext = dirwaytext & "Show this agreement"
end if

That way it concatenates the body of the email message (which is the variable dirwaytext according to your script) instead of replacing it.

:)

details
07-17-2002, 04:49 PM
Now, can I get the variable dirwaytext to send html format?


if strDWDT= "yes" then
dirwaytext = "Show this agreement"
end if

details
07-17-2002, 05:57 PM
I am still getting the same errors. When two products with the same agreement are bought it sends nothing. When two products with different agreements is send the first.?
:confused: :confused: :mad:

whammy
07-18-2002, 12:37 AM
Did you concatenate it in all of the If/Then statements?!?

if strDWDT= "yes" then
dirwaytext = dirwaytext & "Show this agreement (strDWDT)" & chr(13)
end if

if strNew= "yes" then
dirwaytext = dirwaytext & "Show this agreement (strNew)" & chr(13)
end if

if strExisting= "yes" then
dirwaytext = dirwaytext & "Show this agreement (strExisting)" & chr(13)
end if

if strDWAemail= "yes" then
dirwaytext = dirwaytext & "Show this agreement (strDWAemail)" & chr(13)
end if

if strAccessories = "yes" then
dirwaytext = dirwaytext & "Show this agreement (strAccessories)" & chr(13)
end if


And, to send HTML format, you need to add these two lines:

objMsg.mailFormat = 0 'This is for HTML
objMsg.bodyFormat = 0 'This is for HTML