Eksempelkoden fra Dandomain her skal vel egentlig bare puttes ind på en jMail sende side og opfange de et par variabler.
Det er et reservationssystem, hvor, når der er foretaget en bestilling, bliver fremsendt en mail til administrator. Og derudover så en SMS til administrators mobilnummer.
Ser det ladesiggøreligt nok ud?
Kode til siden:
<%
Dim ListID
Dim Username, Password
'##############################################
'//Login til SMS gateway - brugernavn\\
username = ""
'//Login til SMS gateway - password\\
password = ""
'//Login til SMS gateway - tilmeld listid\\
ListID = ""
'##############################################
SubscribeErrorMessage = ""
Private Function HTMLDecode(byVal encodedstring)
Dim tmp, i
tmp = encodedstring
tmp = Replace( tmp, """, chr(34) )
tmp = Replace( tmp, "<" , chr(60) )
tmp = Replace( tmp, ">" , chr(62) )
tmp = Replace( tmp, "&" , chr(38) )
tmp = Replace( tmp, " ", chr(32) )
For i = 1 to 255
tmp = Replace( tmp, "&#" & i & ";", chr( i ) )
Next
HTMLDecode = tmp
End Function
if request("action") = "add" then
DataIsValid = true
phone = request("phone")
if phone = "" then
DataIsValid = false
response.write "Udfyld mobil-nr."
end if
if LEFT(phone, 3) <> "+45" then
phone = "+45" & phone
end if
if DataIsValid then
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.open "post", "
http://sms.dandomain.dk/services/injectionservice.asmx", False, "", ""
strMethodPkg = ""
strMethodPkg = strMethodPkg & "<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg & "<soap:Envelope xmlns:xsi=""
http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""
http://www.w3.org/2001/XMLSchema"" xmlns:soap=""
http://schemas.xmlsoap.org/soap/envelope/"">" strMethodPkg = strMethodPkg & " <soap:Header>"
strMethodPkg = strMethodPkg & " <AuthInfo xmlns=""
http://www.dandomain.dk/SmsGateway"">" strMethodPkg = strMethodPkg & " <Username>"&username&"</Username>"
strMethodPkg = strMethodPkg & " <Password>"&password&"</Password>"
strMethodPkg = strMethodPkg & " </AuthInfo>"
strMethodPkg = strMethodPkg & " </soap:Header>"
strMethodPkg = strMethodPkg & " <soap:Body>"
strMethodPkg = strMethodPkg & " <CreateSubscriber xmlns=""
http://www.dandomain.dk/SmsGateway"">" strMethodPkg = strMethodPkg & " <sublistid>"&ListID&"</sublistid>"
strMethodPkg = strMethodPkg & " <subscriberinfo>"
strMethodPkg = strMethodPkg & " <Id>0</Id>"
strMethodPkg = strMethodPkg & " <Number>"&phone&"</Number>"
strMethodPkg = strMethodPkg & " <Active>true</Active>"
strMethodPkg = strMethodPkg & " </subscriberinfo>"
strMethodPkg = strMethodPkg & " </CreateSubscriber>"
strMethodPkg = strMethodPkg & " </soap:Body>"
strMethodPkg = strMethodPkg & "</soap:Envelope>"
objXMLHTTP.setRequestHeader "Content-Type", "text/xml"
objXMLHTTP.setRequestHeader "SOAPAction", "
http://www.dandomain.dk/SmsGateway/CreateSubscriber" objXMLHTTP.send strMethodPkg
XMLOutput = HTMLDecode(objXMLHTTP.responseText)
Statuscode = objXMLHTTP.status
if objXMLHTTP.status <> "200" then
IsValid = False
end if
Set objXMLHTTP = Nothing
if IsValid = false then
Dim oXml, SingleNode
Set oXml = Server.CreateObject("Microsoft.XMLDOM")
oXml.async = false
oXml.LoadXML(XMLOutput)
Set SingleNode = oXml.documentElement.selectSingleNode("soap:Body/CreateSubscriberResponse/CreateSubscriberResult")
if SingleNode.text = "OK" then
response.write "Tilmelding OK"
else
response.write "Tilmelding fejlede"
end if
Set oXml = Nothing
end if
else
end if
end if
%>