You sure can and it is similar to sending an email using a normal smtp:
<%
'##################################################
'# Requirements: dvmailer.dll
'##################################################
'##################################################
'# Set Global Variables
'##################################################
SMTP_SERVER = "mail.domain.com"
SMTP_SERVER_PORT = 25
'##################################################
'# Function to send the SMS via email
'#
'# Returns True/False whether the email was sent.
'##################################################
Public Function SendSMS(msgToEmailAddress, msgFromEmailAddress, msgSubject, msgText)
' Set the various lengths associated with each carrier
' AT&T
If (InStr(1, msgToEmailAddress, "mobile.att.net") > 1) Then
maxLength = 140
' Nextel
ElseIf (InStr(1, msgToEmailAddress, "messaging.nextel.com") > 1) Then
maxLength = 280
' Sprint PCS
ElseIf (InStr(1, msgToEmailAddress, "messaging.sprintpcs.com") > 1) Then
maxLength = 100
' Default Length
Else
maxLength = 140
End If
' Typically, there are at least two characters of delimiter between the from,
' subject, and text on the screen of the mobile device.
'We must add this into the equation in order to ensure
' the entire message gets sent to the device.
msgLength = len(msgFromEmailAddress & " " & msgSubject & " " & msgText)
' This is here to make sure the message isn't longer than the device supports.
If ( msgLength > maxLength) Then
' Return false
SendSMS = false
Else
' Create DevMailer Object
Set Mailer = CreateObject("Geocel.Mailer")
' Add SMTP server
Mailer.AddServer SMTP_SERVER, SMTP_SERVER_PORT
' Set From
Mailer.FromAddress = msgFromEmailAddress
' Set Subject
Mailer.Subject = msgSubject
' Set Content Type to Text Only
Mailer.ContentType = "text/plain; charset=us-ascii"
' Set the body
Mailer.Body = msgText
' Add recipient
Mailer.AddRecipient msgToEmailAddress, ""
' Send It
SendSMS = Mailer.Send()
End If
End Function
%>
The sendsms.asp will pull in this function and send off a text message.
<!--#include virtual="/sms.inc"-->
<%
msgTo = "3131234567@messaging.sprintpcs.com"
msgFrom = "joelauer@domain.com"
msgSubject = "Hello World"
msgText = "First text-message!!"
'Attempt to send the sms
IsSent = SendSMS(msgTo, msgFrom, msgSubject, msgText)
if IsSent then
Response.Write("SMS successfully sent to " & msgTo)
else
Response.Write("SMS not successfully sent to " & msgTo)
end if
%>
For Send SMS Through Code:
C#.net:
Step 1: Add Web Reference :
http://www.spiritssoft.com/webservice/sendway2sms.asmx
Step 2: Add This “using com.spiritssoft.www;”
Step 3: Create a Object “SendWay2Sms smsobj = new SendWay2Sms();”
Step 4:
string strResult = smsobj.sendSmsSpiritsSoft(“UserName”, “Password”, “Number”, “message”);
strResult : Recieving the Result from Webservice
Note:
– For Group SMS , Number seperated by commas(,).
– Message should be Only 125 characters,
– If No username , password form way2sms.com it will send message
through Spirits Soft Technology Default Number.
From : Spirits Soft Technology
http://www.spiritssoft.com
I got error :startindex can not be less zero