Takker for dit script, men det kan jo ikke det som jeg skal bruge. Man skal kunne sende en sms på 800 tegn, dvs. at den deler den sms op i 5 sms beskeder !
intMailer = 0 strSMTP = "mail.snuseren.dk" ' SMTP server strAfs = "postmaster@snuseren.dk" ' En gyldig POP3 konto
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)
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)) => 2610 And CInt(Left(strNummer, 4)) =< 2699 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)) = 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
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 = "<font face='Tahoma' size=2 color=#008000>Din besked blev sendt af <b>" & intMsgSize & "</b> SMS´er til <b>" & strNummer & "</b>.</font>" Case False: strSendt = "<font face='Tahoma' size=2 color=#008000>Din besked blev sendt til <b>" & strNummer & "</b>!</font>" End Select Else strSendt = "<font face='Tahoma' size=2 color=#800000>Beskeden kunne ikke sendes da det indtastede tlf.<br>nummer ikke er et gyldigt mobil nummer!</font>" End If End If End If End If %> <html> <head> <title>Send SMS</title> <script language="JavaScript"> <!-- function showleft() { document.frmSms.count.value=800-(document.frmSms.besked.value.length+document.frmSms.fra.value.length); } function checklength() { if (document.frmSms.besked.value.length+document.frmSms.fra.value.length > 800) { alert("Din besked må max. være på 800 tegn!"); document.frmSms.besked.focus(); return (false); } else if (document.frmSms.nummer.value.length !=8) { alert("Du skal skrive et gyldigt 8-cifret tlf. nummer!"); document.frmSms.nummer.focus(); return (false); } else if (document.frmSms.fra.value.length == 0) { alert("Du skal skrive et afsender navn/tlf. nummer!"); document.frmSms.fra.focus(); return (false); }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.