<% ''''''''''' (C) Stefan Holmberg 1999 ''''''''''' Free to use if these sourcecode lines is not deleted ''''''''''' Contact me at webmaster@sqlexperts.com ''''''''''' http://www.sqlexperts.com ''''''''''' AdMentor homepage at http://www.create-a-webshop.com ' Script modified by Michael Cleland ' michael@activeenzymes.com.au ' http://www.activeenzymes.com.au/postcard ' First of all lets just get all variables Dim nCardId, sNameTo, sNameFrom, sEmailFrom, sText, sBGColor, sTextColor, sEmailTo ' Create encypted password to collect card Function Password_GenPass( nNoChars, sValidChars ) ' nNoChars = length of generated password ' sValidChars = valid characters. If zerolength-string ' default is used: A-Z AND a-z AND 0-9 Const szDefault = "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789" Dim nCount Dim sRet Dim nNumber Dim nLength Randomize 'init random If sValidChars = "" Then sValidChars = szDefault End If nLength = Len( sValidChars ) For nCount = 1 To nNoChars nNumber = Int((nLength * Rnd) + 1) sRet = sRet & Mid( sValidChars, nNumber, 1 ) Next Password_GenPass = sRet End Function nCardId = Request.Form("fldAuto") if nCardId = "" Then Response.Redirect "." End If 'Ok... sNameTo = Request.Form("nameto") sNameFrom = Request.Form("namefrom") sEmailFrom = Request.Form("emailfrom") sEmailTo = Request.Form("emailto") sNotifySenderPickup = Request.Form("notifysenderpickup") sGreeting = Request.Form("greeting") sText = Request.Form("sText") sBGColor = Request.Form("BgColor") sTextColor = Request.Form("TColor") 'Save it to database Dim oRS Set oConn = PostCard_GetDatabaseConn() oConn.Execute "update card set sendcount=sendcount+1 where fldAuto=" & nCardId Set oRS = Server.CreateObject("ADODB.Recordset") oRS.Open "select * from createdpostcards where fldAuto=-1 " ,oConn ,adOpenKeyset,adLockOptimistic oRS.AddNew oRS("cardid") = nCardId oRS("nameto") = sNameTo oRS("namefrom") = sNameFrom oRS("emailto") = sEmailTo oRS("emailfrom") = sEmailFrom oRS("notifysenderpickup") = sNotifySenderPickup oRS("greeting") = sGreeting oRS("stext") = sText oRS("bgcolor") = sBGColor oRS("textcolor") = sTextcolor ' New addition of encryption for password sOtherId = "enCard" + Password_GenPass( 10, "" ) oRS("otherid")= sOtherId oRS.Update Dim IDToSend Dim Mail IDToSend = sOtherID ' IDToSend = oRS("fldAuto").Value & "---"& oRS("emailto").Value oRS.Close ' Send postcard alert to recipient strMsgHeader = sNameFrom & " (" & sEmailFrom & ")" & " has sent you a postcard!" & vbCrLf & vbCrLf strMsgHeader = strMsgHeader & "The address to pick it up is : " & vbCrLf & vbCrLf & GetPathToPickupScript() & "?cardid=" & IDToSend strMsgHeader = strMsgHeader & vbCrLf & vbCrLf & "Alternatively, you can visit " & live_serverURL & " and collect your card by " strMsgHeader = strMsgHeader & "pasting in the following:" & vbCrLf & vbCrLf & IDToSend strMsgFooter = vbCrLf & vbCrLf & vbCrLf & "** Send your own " & postcard_name & " postcard!" & vbCrLf & "** Visit " & live_serverURL & "" 'Set JMail = Server.CreateObject("JMail.SMTPMail") Set Mail = Server.CreateObject("Persits.MailSender") 'JMail.ServerAddress = mail_server Mail.Host = mail_server 'JMail.Sender = sEmailFrom Mail.From = webmaster_email 'JMail.Subject = sNameFrom & " has sent you a postcard" Mail.Subject = sNameFrom & " has sent you a postcard" 'JMail.AddRecipient (sEmailTo) Mail.AddAddress (sEmailTo) 'JMail.AddRecipientBCC (webmaster_email) 'JMail.Body = (strMsgHeader & strMsgFooter) Mail.Body = (strMsgHeader & strMsgFooter) 'JMail.Priority = 1 'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR") 'JMail.execute Mail.Send ' Send postcard to webmaster strMsgHeader = "A postcard has been sent to " & sNameTo & " (" & sEmailTo & ") from " & sNameFrom & " (" & sEmailFrom & ")" & vbCrLf & vbCrLf strMsgHeader = strMsgHeader & "You can view a copy of the postcard you sent by going to : " & vbCrLf & vbCrLf & GetPathToPickupScript() & "?cardid=" & IDToSend & "&sr=no " strMsgHeader = strMsgHeader & vbCrLf & vbCrLf & "Alternatively, you can visit " & live_serverURL & " and view a copy of your card by " strMsgHeader = strMsgHeader & "pasting in the following:" & vbCrLf & vbCrLf & IDToSend & "&sr=no" strMsgFooter = vbCrLf & vbCrLf & vbCrLf & "** Send your own " & postcard_name & " postcard!" & vbCrLf & "** Visit " & live_serverURL & "" 'Set JMail = Server.CreateObject("JMail.SMTPMail") Set Mail = Server.CreateObject("Persits.MailSender") 'JMail.ServerAddress = mail_server Mail.Host = mail_server 'JMail.Sender = sEmailFrom Mail.From = SEmailFrom 'JMail.Subject = sNameFrom & " has sent a postcard to " & sEmailTo Mail.Subject = sNameFrom & " has sent a postcard to " & sEmailTo 'JMail.AddRecipient (webmaster_email) Mail.AddAddress (webmaster_email) 'JMail.Body = (strMsgHeader & strMsgFooter) Mail.Body = (strMsgHeader & strMsgFooter) 'JMail.Priority = 1 'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR") 'JMail.execute Mail.Send ' Send copy to sender of postcard if sNotifySenderPickup = "notifyme" If sNotifySenderPickup = "notifyme" then strMsgHeader = "You've sent a postcard to " & sNameTo & " (" & sEmailTo & ")" & vbCrLf & vbCrLf strMsgHeader = strMsgHeader & "You can view a copy of the postcard you sent by going to : " & vbCrLf & vbCrLf & GetPathToPickupScript() & "?cardid=" & IDToSend & "&sr=no " strMsgHeader = strMsgHeader & vbCrLf & vbCrLf & "Alternatively, you can visit " & live_serverURL & " and view a copy of the postcard you sent by " strMsgHeader = strMsgHeader & "pasting in the following:" & vbCrLf & vbCrLf & IDToSend & "&sr=no" strMsgFooter = vbCrLf & vbCrLf & vbCrLf & "** Send your own " & postcard_name & " postcard!" & vbCrLf & "** Visit " & live_serverURL & "" 'Set JMail = Server.CreateObject("JMail.SMTPMail") Set Mail = Server.CreateObject("Persits.MailSender") 'JMail.ServerAddress = mail_server Mail.Host = mail_server 'JMail.Sender = webmaster_email Mail.From = webmaster_email 'JMail.Subject = "You have sent a postcard to " &sNameTo Mail.Subject = "You have sent a postcard to " &sNameTo 'JMail.AddRecipient (sEmailFrom) Mail.AddAddress (sEmailFrom) 'JMail.Body = (strMsgHeader & strMsgFooter) Mail.Body = (strMsgHeader & strMsgFooter) 'JMail.Priority = 1 'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR") 'JMail.execute Mail.Send End If ' Message sent Ok, redirect to a confirmation page sPostcardToFriend = "thanks.asp?namefrom=" & sNameFrom & "&emailfrom=" & sEmailFrom sPostcardToFriend = Replace(sPostcardToFriend, " ", "%20") Response.Redirect (sPostcardToFriend) %>