How to Send a Message from the Web through Named Pipe
This sample demonstrates how to send a message from the web.
Files used in this sample are located in the folder:
C:\Program Files\CodeSegment\SMS Studio\Samples\InfoService\WebSend
The contents of the send_sms.asp file:
<%
AllowedIP = "127.0.0.1"
RemoteIP = Request.ServerVariables("REMOTE_ADDR")
RemoteIP = AllowedIP
if RemoteIP = AllowedIP then
MsgText = Request("msg")
Sender = Request("from")
Recipient = Request("to")
PipeName = "WebSendPipe"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set pipe = fso.CreateTextFile("\\.\pipe\" & PipeName)
pipe.WriteLine("From: " & Sender)
pipe.WriteLine("To: " & Recipient)
pipe.WriteLine("Body: " & MsgText)
pipe.WriteLine("<Send>")
pipe.Close
response.write("Ok")
else
response.write("Not allowed.")
end if
%>
How to run this sample
- Install a web server on your computer. See How to Setup a Web Server for detailed instructions.
- Copy the send_sms.asp and test_send_sms.htm files to a folder accessible by your web
server (e.g. C:\Inetpub\wwwroot\smsstudio).
- Click the New button on the main toolbar and select the Info service option in the New Service dialog.
- Click the Setup button on the main toolbar to display the Info Setup dialog.
- In the Advanced tab of the Info Setup dialog enter the following parameters:
Pipe name: WebSendPipe
Remote user: Everyone (or use IUSR_machine_name to restrict access to your web users only)
Default reply account: Use the selection button ( ... ) to select the account to send messages with.
- Click the OK button to close the Info Setup dialog.
- Click the Start button on the main toolbar to start the Info service.
- To test sending on your computer, use the following link:
http://localhost/smsstudio/test_send_sms.htm.
Fill in the fields and click the Submit
button. You should see the confirmation page in your browser. Check the Outbox window in SMS Studio to see the status of the outgoing message.
- To test sending from a remote location, use the following link:
http://YOUR_DOMAIN_NAME_OR_IP_ADDRESS/smsstudio/test_send_sms.htm
- You can now inform your client to send messages by using the following syntax:
http://YOUR_DOMAIN_NAME_OR_IP_ADDRESS/smsstudio/send_sms.asp?from=SENDER&to=RECIPIENT&msg=MESSAGE_TEXT
Related topics
Named Pipe