![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How can I fix this? sub SendErrorEmail(err) Dim mailer set mailer = server.CreateObject("CDONTS.NewMail") 'set the properties mailer.From = "webmaster (AT) mywebsite (DOT) com" mailer.To = "email (AT) mywebsite (DOT) com" mailer.Subject = "Process payment problem" mailer.Body = err & vbcrlf & Details mailer.Send response.end end sub sub SendThankYou() Dim mailer set mailer = server.CreateObject("CDONTS.NewMail") mailer.From = "email (AT) mywebsite (DOT) com" mailer.To = Payer_email mailer.Subject = "Thank you for your order" mailer.Body = "Thank you for your order." mailer.Send end sub |
#3
| |||
| |||
|
|
It's doubtful that you'll get an answer until you can show how this relates to MS-Access, and specifically what's wrong with it. What error message(s) are you getting, and at what line(s) do you get them? |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Here is the complete code with the MS Access calls. Thank you for replying. Jim Rojas % Dim Item_name, Item_number, Payment_status, Payment_amount Dim Txn_id, Receiver_email, Payer_email Dim objHttp, str set conn = Server.CreateObject("ADODB.Connection") conn.open = application("connStr") YourEmail = "myemailaddress" 'set fs = server.CreateObject("scripting.fileSystemObject") 'set a = fs.createTextFile("c:\temp\ipn" & rnd & ".txt", true) Details = "" for each var in request.Form Details = Details & var & " = " & request.Form(var) & vbcrlf next 'a.close 'response.end str = Request.Form & "&cmd=_notify-validate" 'set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0") set objHttp = Server.CreateObject("Microsoft.XMLHTTP") objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded" objHttp.Send str ' assign posted variables to local variables Item_name = Request.Form("item_name") Item_number = Request.Form("item_number") Payment_status = Request.Form("payment_status") Payment_amount = Request.Form("mc_gross") Payment_currency = Request.Form("mc_currency") Txn_id = Request.Form("txn_id") Receiver_email = Request.Form("receiver_email") Payer_email = Request.Form("payer_email") Usernum = request.Form("custom") ' Check notification validation if (objHttp.status <> 200 ) then ' HTTP error handling elseif (objHttp.responseText = "VERIFIED") then if Payment_status = "Completed" and lcase(Receiver_email) = lcase(YourEmail) and Payment_currency = "USD" then ' check that Payment_amount/Payment_currency are correct ' process payment set rs = conn.Execute("Select * from Transactions where TransactionID='" & Txn_id & "'") if not rs.eof then response.Write("Transaction already processed") response.end end if 'record this transaction sql = "insert into Transactions (TransactionID, Usernum, PayerEmail, Total, Details) values (" sql = sql & "'" & replace(Txn_id, "'", "''") & "'," sql = sql & clng(userNum) & "," sql = sql & "'" & replace(Payer_email, "'", "''") & "'," sql = sql & clng(payment_amount) & "," sql = sql & "'" & replace(Details, "'", "''") & "')" conn.execute(sql) set rs = conn.Execute("select * from AccessLevels where ID=" & item_number) price = rs("price") daysToAdd = rs("Days") aType = 2 if price >= 250 then aType=7 set rs = conn.Execute("Select expires from tUsers where userNum=" & userNum) if isnull(expires) then expires = now() if not isDate(expires) then expires = now() if expires < now() then expires = now() expires = dateAdd("d", daysToAdd, expires) conn.Execute("update tUsers set Expires='" & expires & "',Account_type=" & aType & " where UserNum=" & UserNum) SendThankYou response.Write("process payment") else 'something is wrong SendErrorEmail "unverified" end if elseif (objHttp.responseText = "INVALID") then SendErrorEmail "invalid" else SendErrorEmail "something else" end if set objHttp = nothing sub SendErrorEmail(err) Dim sendmail Dim cdoConfig 'sets variables sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = Server.CreateObject("CDO.Configuration") cdoConfig.Fields.Item(sch & "sendusing") = 2 cdoConfig.Fields.Item(sch & "smtpserver") = "localhost" cdoConfig.Fields.Item(sch & "smtpserverport") = 25 cdoConfig.Fields.Item(sch & "connectiontimeout") = 10 cdoConfig.fields.update Set sendmail = Server.CreateObject("CDO.Message") Set sendmail.Configuration = cdoConfig 'set the properties Sendmail.From = "myemailaddress" Sendmail.To = Youremail Sendmail.Subject = "Process payment problem" Sendmail.HTMLBody = err & vbcrlf & Details Sendmail.Send response.end end sub sub SendThankYou() Dim sendmail Dim cdoConfig 'sets variables sch = "http://schemas.microsoft.com/cdo/configuration/" Set cdoConfig = Server.CreateObject("CDO.Configuration") cdoConfig.Fields.Item(sch & "sendusing") = 2 cdoConfig.Fields.Item(sch & "smtpserver") = "localhost" cdoConfig.Fields.Item(sch & "smtpserverport") = 25 cdoConfig.Fields.Item(sch & "connectiontimeout") = 10 cdoConfig.fields.update Set sendmail = Server.CreateObject("CDO.Message") Set sendmail.Configuration = cdoConfig 'set the properties Sendmail.From = "myemailaddress" Sendmail.To = Payer_email Sendmail.Subject = "Thank you for your order" Sendmail.HTMLBody = "Thank you for your order at mywebsite" Sendmail.Send response.end end sub % |
#6
| |||
| |||
|
|
I don't see anything that stands out. What error messages are you getting? I don't see any error code in there that would display errors, so you may want to add msgbox(s) to check values and display errors. |
![]() |
| Thread Tools | |
| Display Modes | |
| |