<% '************************************************************** ' VP-ASP 6.50 ' March 18, 2003 ' Used to send mail for shopmaillist ' Nov 29, 2004 fix mysql support '*************************************************************** Sub SendMailCustomer (isubject, stremail, strfirstname, strlastname) dim acount, CR, url dim my_attachment, htmlformat dim authcode authcode=generaterandom() if isubject="subscribe" then authcode="a" & authcode 'subscribe to maillist else authcode="r" & authcode 'remove from mailist end if htmlformat="Text" CR=vbcrlf 'VP-ASP 6.09 - removed slash after xmysite call url=getconfig("xmysite") & "shopmaillistauthorize.asp?authcode=" & authcode my_attachment="" mailtype=getconfig("xemailtype") my_from=getconfig("xemailname") my_fromaddress=getconfig("xemail") my_toaddress=stremail my_to=strlastname my_system=getconfig("xemailsystem") my_subject=isubject & " maillist" if isubject="subscribe" then body = body & getlang("langmaillistsubscribe") else body = body & getlang("langmaillistremove") end if Body=body & CR & CR body=body & Url & CR acount=0 ExecuteMail mailtype,My_from,my_fromaddress,my_to,my_toaddress,my_subject,body,htmlformat,my_attachment,acount If getconfig("xdebug")="Yes" then debugwrite "Mailing to: " & my_to & "(" & my_toaddress & ") from " & strlastname & " " & stremail end if AddAuthCode authcode end sub ' sub AddAuthcode(code) dim dbc, whereok dim doupdate, templastname OpenCustomerDb dbc templastname=replace(strlastname,"'","''") SQL = "update customers set contactreason='" & code & "'" whereok=" where " sql=sql & whereok & " lastname='" & templastname & "'" whereok = " AND " SQL = SQL & whereok & " email='" & stremail & "'" dbc.execute(sql) shopclosedatabase dbc end sub function GenerateRandom dim number, upperbound, lowerbound randomize upperbound=999999 lowerbound=100000 number=clng((upperbound - lowerbound + 1) * Rnd + lowerbound) generaterandom=number End function %>