![]() |
| Switching from JMail to ASPMail |
|
gtj0788
|
I am new to ASP and would like to know how to switch from JMail to ASPMail. Here is the script and I hope to get some help on how to convert the script to ASPmail. Thanks
<% path_URL= path_URLIMG= strMailServer="mail.mydomain.com" strEmailReceiver="customercare@mydomain.com" strGlobalEmailCom = "cdont" '------------------------------------------------------------------------------------------------------ Public function Paging(ByVal intPage, ByVal intPageCount, ByVal intRecordCount) 'Customize me to your liking... 'Assumes that the paging request variable is named 'page' Dim strQueryString Dim strScript Dim intStart Dim intEnd Dim strRet Dim i if intPage > intPageCount Then intPage = intPageCount ElseIf intPage < 1 Then intPage = 1 End if if intRecordCount = 0 Then strRet = "" ElseIf intPageCount = 1 Then strRet = "" Else For i = 1 To Request.QueryString.Count if LCase(Request.QueryString.Key(i)) <> "page" Then strQueryString = strQueryString & "&" strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Key(i)) & "=" strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Item(i)) End if Next For i = 1 To Request.Form.Count if LCase(Request.Form.Key(i)) <> "page" Then strQueryString = strQueryString & "&" strQueryString = strQueryString & Server.URLEncode(Request.Form.Key(i)) & "=" strQueryString = strQueryString & Server.URLEncode(Request.Form.Item(i)) End if Next if Len(strQueryString) <> 0 Then strQueryString = "?" & Mid(strQueryString, 2) & "&" Else strQueryString = "?" End if strScript = Request.ServerVariables("SCRIPT_NAME") & strQueryString if intPage <= 10 Then intStart = 1 Else if (intPage Mod 10) = 0 Then intStart = intPage - 9 Else intStart = intPage - (intPage Mod 10) + 1 End if End if intEnd = intStart + 9 if intEnd > intPageCount Then intEnd = intPageCount strRet = "" if intPage <> 1 Then strRet = strRet & "<A href=""" & strScript strRet = strRet & "page=" & intPage - 1 strRet = strRet & """>[<< Prev]</A> " End if For i = intStart To intEnd if i = intPage Then strRet = strRet & "<B><font color=black >" & i & "</font></B> " Else strRet = strRet & "<A href=""" & strScript strRet = strRet & "page=" & i strRet = strRet & """>" & i & "</A>" if i <> intEnd Then strRet = strRet & " " End if Next if intPage <> intPageCount Then strRet = strRet & " <A href=""" & strScript strRet = strRet & "page=" & intPage + 1 strRet = strRet & """>[Next>>]</A> " End if End if Paging = strRet End function '------------------------------------------------------------------------------------------------------- Function SearchKey(sSQL) Dim sTemSql sTemSql = replace(sSQL, "'", "''") sTemSql = replace(sTemSql, "*", " ") sTemSql = replace(sTemSql, "#", " ") SearchKey = sTemSql End Function '------------------------------------------------------------------------------------------------------------------ Function chkmail(email) If(Instr(email, "@")>0 and Instr(email, ":")<=0 and Instr(email, ";")<=0_ and Instr(email, ",")<=0 and Instr(email, "<")<=0 and Instr(email, ">")<=0_ and Instr(email, "?")<=0 and Instr(email, "/")<=0 and Instr(email, "\")<=0_ and Instr(email, "=")<=0 and Instr(email, "+")<=0 and Instr(email, "*")<=0_ and Instr(email, "&")<=0 and Instr(email, "%")<=0 and Instr(email, "$")<=0_ and Instr(email, "#")<=0 and Instr(email, "!")<=0 and Instr(email, "`")<=0_ and Instr(email, "~")<=0 and Instr(email, """")<=0 and Instr(email, "'")<=0_ and Instr(email, ".")>0 and Instr(email, " ")<=0) Then chkmail=True Else chkmail=False End If End Function '------------------------------------------------------------------------------------------------------------------ Function chkMI(StrMI) If( Instr(StrMI, "@")<=0 and Instr(StrMI, ":")<=0 and Instr(StrMI, ";")<=0_ and Instr(StrMI, ",")<=0 and Instr(StrMI, "<")<=0 and Instr(StrMI, ">")<=0_ and Instr(StrMI, "?")<=0 and Instr(StrMI, "/")<=0 and Instr(StrMI, "\")<=0_ and Instr(StrMI, "=")<=0 and Instr(StrMI, "+")<=0 and Instr(StrMI, "*")<=0_ and Instr(StrMI, "&")<=0 and Instr(StrMI, "%")<=0 and Instr(StrMI, "$")<=0_ and Instr(StrMI, "#")<=0 and Instr(StrMI, "!")<=0 and Instr(StrMI, "`")<=0_ and Instr(StrMI, "~")<=0 and Instr(StrMI, """")<=0 and Instr(StrMI, "'")<=0_ and Instr(StrMI, "1")<=0 and Instr(StrMI, "2")<=0 and Instr(StrMI, "3")<=0_ and Instr(StrMI, "4")<=0 and Instr(StrMI, "5")<=0 and Instr(StrMI, "6")<=0_ and Instr(StrMI, "7")<=0 and Instr(StrMI, "8")<=0 and Instr(StrMI, "9")<=0_ and Instr(StrMI, "0")<=0 and Instr(StrMI, ".")<=0 and Instr(StrMI, " ")<=0) Then chkMI=True Else chkMI=False End If End Function '----------------------------------------------------------------------------------------------------------------------- Function chkUsername(username) If(Instr(username, "%")=0 and Instr(username, ":")=0 and Instr(username, ";")<=0_ and Instr(username, ",")<=0 and Instr(username, "<")<=0 and Instr(username, ">")<=0_ and Instr(username, "?")<=0 and Instr(username, "/")<=0 and Instr(username, "\")<=0_ and Instr(username, "=")<=0 and Instr(username, "+")<=0 and Instr(username, "*")<=0_ and Instr(username, "&")<=0 and Instr(username, "%")<=0 and Instr(username, "$")<=0_ and Instr(username, "#")<=0 and Instr(username, "!")<=0 and Instr(username, "`")<=0_ and Instr(username, "~")<=0 and Instr(username, """")<=0 and Instr(username, "'")<=0_ and Instr(username, "|")<=0 and Instr(username, " ")<=0) Then chkUsername=true Else chkUsername=false End If End Function '------------------------------------------------------------------------------------------------------- Function String2SQL(sSQL) Dim sTemSql sTemSql = replace(sSQL, "'", "''") sTemSql = "'" & sTemSql & "'" String2SQL = sTemSql End Function '-------------------------------------------------------------------- Function String2SQLSearch(sSQL) Dim sTemSql sTemSql = replace(sSQL, "'", "''") sTemSql = replace(sSQL, "*", "") sTemSql = replace(sSQL, "#", "") sTemSql = replace(sSQL, "%", "") String2SQLSearch = sTemSql End Function '----------------------------------------------------------------- public sub sendmail(mFromName,mFromMail,mSubject,mToname, mToemail,mBody) ' change to address of your own SMTP server if strGlobalEmailCom = "persit" then strHost=strMailServer Session.CodePage = 65001 Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = strHost Mail.From = mFromMail Mail.FromName = mFromName Mail.AddAddress mToemail Mail.UserName="customercare@mydomain.com" Mail.Password="awake" Mail.Subject = mSubject Mail.CharSet = "UTF-8" Mail.IsHTML =true Mail.Body =mBody 'On Error Resume Next Mail.Send If Err <> 0 Then Response.Write "Error encountered: " & Err.Description End If elseif strGlobalEmailCom = "cdont" then set mail = server.CreateOBject( "JMail.Message" ) mail.Logging = true mail.silent = true mail.From = mFromMail mail.FromName = mFromName mail.Subject = mSubject mail.ContentType = "text/html" mail.AddRecipient mToemail ' if the client cannot read HTML mail.Body = mBody on error resume next mail.send("127.0.0.1") 'Set ASPMail = Server.CreateObject ("CDONTS.NewMail") 'ASPMail.From = mFromName & "<" & mFromMail & ">" 'ASPMail.Subject = mSubject 'ASPMail.To =mToname & "<" & mToemail & ">" 'ASPMail.Body = mBody 'ASPMail.Importance = 1 'ASPMail.BodyFormat = 0 'ASPMail.MailFormat = 0 ''On Error Resume Next 'ASPMail.Send 'If Err <> 0 Then ' Response.Write "Error encountered: " & Err.Description 'End If 'Set ASPMail = nothing end if end sub '------------------------------------------------------------------------------------------------------- Function GetCurrentURL() For i = 1 To Request.QueryString.Count strQueryString = strQueryString & "&" strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Key(i)) & "=" strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Item(i)) Next For i = 1 To Request.Form.Count strQueryString = strQueryString & "&" strQueryString = strQueryString & Server.URLEncode(Request.Form.Key(i)) & "=" strQueryString = strQueryString & Server.URLEncode(Request.Form.Item(i)) Next if Len(strQueryString) <> 0 Then strQueryString = "?" & Mid(strQueryString, 2)' & "&" Else strQueryString = "?" End if strScript = Request.ServerVariables("SCRIPT_NAME") & strQueryString GetCurrentURL = strScript End Function '------------------------------------------------------------------------------------------------------- Function SelectControlSetData(artValue,artstateValue,sCompa re, ctrlName) Dim sStr sStr = "<select name=""" & ctrlName & """ class=""cls_text"">" sStr = sStr & "<option value="""""">Select a State</option>" for i = 0 to Ubound(artValue) if Lcase(artValue(i)) = lcase(sCompare) then sStr = sStr & "<option selected value=""" & artValue(i) & """>" & artstateValue(i) & "</option>" else sStr = sStr & "<option value=""" & artValue(i) & """>" & artstateValue(i) & "</option>" end if next sStr = sStr & "</select>" SelectControlSetData = sStr end function %> |
||||||||||||
|
|
|||||||||||||
| Switching from JMail to ASPMail |
|
||
|


