Imports System.Text Imports System.IO Imports System.Net Imports System.Web Imports System.Web.Services Imports ClassLibrary1 Imports ClassLibrary1.Krystalware Imports ClassLibrary1.Krystalware.UploadHelper Imports ClassLibrary1.Krystalware.UploadHelper.HttpUploadHelper Imports ClassLibrary1.Krystalware.UploadHelper.MimePart Imports ClassLibrary1.Krystalware.UploadHelper.StreamMimePart Imports ClassLibrary1.Krystalware.UploadHelper.StringMimePart Imports ClassLibrary1.Krystalware.UploadHelper.UploadFile Imports System.Collections.Specialized Public Class Form1 Public Sub SendMMS() ' Set the following variables as appropriate for your system. ' URL that points to NowSMS web interface Dim url As New Uri(" http://127.0.0.1:8800/ ") ' Valid username/password for account defined in NowSMS under "SMS Users". Dim username As [String] = "testuser" Dim password As [String] = "testpass" ' Images & Files to be included in the message. ' First parameter is filename and path. ' Second parameter must be MMSFILE ' Third parameter should be MIME type Dim files As UploadFile() = New UploadFile() { New UploadFile("c:\mms\tts.mp3", "MMSFILE", "audio/mpeg"), New UploadFile("c:\mms\image.png", "MMSFILE", "image/png")} ' Create additional form parameters for sending MMS Dim form As New NameValueCollection() ' "PhoneNumber" variable contains recipient phone number form("PhoneNumber") = "09059999999" ' "MMSFROM" variable contains sender phone number or address ' (Note: Ignored when sending via modem) form("MMSFROM") = "09058888888" ' "MMSSUBJECT" variable contains subject line for message form("MMSSUBJECT") = "test subject" ' "MMSTEXT" variable contains test to appear in message (optional) form("MMSTEXT") = "this is a test message" ' Send the request to NowSMS, creating an HttpWebRequest and ' then use HttpUploadHelper to send files in multipart/form-data format Dim req As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest) Dim credCache = New CredentialCache() credCache.Add(url, "Basic", New NetworkCredential(username, password)) req.Credentials = credCache Dim resp As HttpWebResponse = HttpUploadHelper.Upload(req, files, form) ' Read the HTTP response and echo to console Using s As Stream = resp.GetResponseStream() Using sr As New StreamReader(s) Dim response As String = sr.ReadToEnd() MsgBox(response) System.Console.WriteLine(response) End Using End Using End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SendMMS() End Sub End Class