04. december 2001 - 19:56
#3
<%
Function Wrap(ByVal Text, ByVal WrapChar, ByVal WrapAt)
\' *****************************************************************************************************
\' * WordWrap v1.2 - WordWraps a string off as near as possible to the specified max character amount *
\' * By Thomas Daugaard, December 11th, 2000. *
\' * *
\' * Arguments: Text : The string to wordwrap *
\' * WrapChar : A string specifying how/with what to wrap the string. Default is <br> *
\' * WrapAt : Numeric value specifying the maximum amount of characters allowed in a *
\' * string. Wraps backwards in the string to ensure that the max value is meet. *
\' * *
\' * Note: Arguments are passed By Value, not reference. *
\' *****************************************************************************************************
Text = Trim(Text)
If Len(Text) =< WrapAt Or Len(Text) = 0 Or InStr(Text, \" \") = 0 Then Wrap = \"\" & Text: Exit Function
If Len(WrapChar) = 0 Then WrapChar = \"<br>\"
Do
If Len(Text) < WrapAt Then strFinal = strFinal & Text: Exit Do
strPart = Left(Text, WrapAt): intOff = WrapAt
If Not Right(strPart, 1) = \" \" Then
intOff = InStrRev(strPart, \" \")
If intOff = 0 Then intOff = InStr(Text, WrapAt, \" \")
If intOff = 0 Then strPart = Text
End If
strPart = Left(Text, intOff)
Text = Right(Text, Len(Text) - Len(strPart))
strFinal = strFinal & strPart & WrapChar
Loop
Wrap = strFinal
End Function
function SMSsender(strNummer, strFra, strBesked)
\' *** SMTP Mail komponent valg ***
\' 0 = JMail
\' 1 = ASPMail
intMailer = 0
strSMTP = \"Domæne\" \' SMTP server rsttes til....
strAfs = \"Email@email\" \' En gyldig POP3 konto rettes til....
If Len(strNummer) > 0 And Len(strFra) > 0 And Len(strBesked) > 0 Then
strTeleDK = \"@sms.tdm.dk\"
strSonofon = \"@note.sonofon.dk\"
strTelia = \"@gsm1800.telia.dk\"
strMobilix = \"@sms.orange.dk\"
bolValid = False
If Len(strNummer) = 8 And IsNumeric(strNummer) Then
If CInt(Left(strNummer, 4)) > 2010 Then
If CInt(Left(strNummer, 4)) => 2010 And CInt(Left(strNummer, 4)) =< 2059 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 2060 And CInt(Left(strNummer, 4)) =< 2099 Then strDom = strSonofon
If CInt(Left(strNummer, 4)) => 2110 And CInt(Left(strNummer, 4)) =< 2199 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 2210 And CInt(Left(strNummer, 4)) =< 2299 Then strDom = strSonofon
If CInt(Left(strNummer, 4)) => 2310 And CInt(Left(strNummer, 4)) =< 2399 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 2320 And CInt(Left(strNummer, 4)) =< 2499 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 2610 And CInt(Left(strNummer, 4)) =< 2699 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 2710 And CInt(Left(strNummer, 4)) =< 2799 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 2810 And CInt(Left(strNummer, 4)) =< 2899 Then strDom = strTelia
If CInt(Left(strNummer, 4)) => 3010 And CInt(Left(strNummer, 4)) =< 3689 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 3690 And CInt(Left(strNummer, 4)) =< 3309 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 3810 And CInt(Left(strNummer, 4)) =< 4049 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 4050 And CInt(Left(strNummer, 4)) =< 4099 Then strDom = strSonofon
If CInt(Left(strNummer, 4)) => 4320 And CInt(Left(strNummer, 4)) =< 4679 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 4690 And CInt(Left(strNummer, 4)) =< 4709 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 4710 And CInt(Left(strNummer, 4)) =< 4979 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) => 5010 And CInt(Left(strNummer, 4)) =< 5199 Then strDom = strTeleDK
If CInt(Left(strNummer, 4)) = 6910 Or CInt(Left(strNummer, 4)) = 6911 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) = 6912 Or CInt(Left(strNummer, 4)) = 6966 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 6960 And CInt(Left(strNummer, 4)) =< 6964 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) = 6969 Or CInt(Left(strNummer, 4)) = 6996 Then strDom = strMobilix
If CInt(Left(strNummer, 4)) => 6980 And CInt(Left(strNummer, 4)) =< 6989 Then strDom = strMobilix
If strDom > \"\" Then
strFra = \"(\" & strFra & \") \"
intSubtract = Len(strFra) + Len(srtAfs) + 24
intMsgSize = (160 - intSubtract)
If intMailer = 0 Then
Set JMail = Server.CreateObject(\"JMail.SMTPMail\")
JMail.ServerAddress = strSMTP
JMail.Sender = strAfs
JMail.AddRecipient (strNummer & strDom)
Else
Set ASPMail = Server.CreateObject(\"SMTPsvg.Mailer\")
ASPMail.RemoteHost = strSMTP
ASPMail.FromAddress = strAfs
ASPMail.AddRecipient \"\", (strNummer & strDom)
End If
If Len(strBesked) > intMsgSize then
strWrapped = Split(Wrap(strBesked, \"|\", intMsgSize), \"|\")
For Index = 0 To UBound(strWrapped)
Select Case intMailer
Case 0: JMail.Body = strFra & strWrapped(Index): JMail.Execute
Case 1: ASPMail.BodyText = strFra & strWrapped(Index): ASPMail.SendMail
End Select
Next
intMsgSize = UBound(strWrapped) + 1
Else
Select Case intMailer
Case 0: JMail.Body = strFra & strBesked: JMail.Execute
Case 1: ASPMail.BodyText = strFra & strBesked: ASPMail.SendMail
End Select
intMsgSize = 1
End If
Set JMail = Nothing
bolValid = True
Select Case (intMsgSize > 1)
Case True: strSendt = \"Din besked blev sendt af <b>\" & intMsgSize & \"</b> SMS´er til <b>\" & strNummer & \"</b>.\"
Case False: strSendt = \"Din besked blev sendt til <b>\" & strNummer & \"</b>.\"
End Select
Else
strSendt = \"Beskeden kunne ikke sendes da det indtastede tlf nummer ikke er et gyldigt mobil nummer, <b>\" & strNummer & \"</b>.\"
End If
Else
strSendt = \"Beskeden kunne ikke sendes da det indtastede tlf nummer ikke er et gyldigt mobil nummer, <b>\" & strNummer & \"</b>.\"
End If
Else
strSendt = \"Beskeden kunne ikke sendes da det indtastede tlf nummer ikke er et gyldigt mobil nummer, <b>\" & strNummer & \"</b>.\"
End If
Else
strSendt = \"Fejl i besked, fra eller mobil nummer!\"
End If
SMSsender = strSendt
end function
%>