Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to send sms on client phone and email id?
Posted
Comments
Prasad Khandekar 14-Mar-13 6:45am    
Hello Shasawat,

Sending SMS to a phone is done either by using an SMS gateway (Http) or GSM Modem with suitable communication library. Emails are generally sent using SMTP and a Mail Server. I don't think there is a single API to do both.

For SMS there is Scamper's GSMComm Library (http://www.scampers.org/steve/sms/libraries.htm). For SMTP DOTNET it self has the necessary classes.

On CodeProject itself you should find couple of article on sending sms or email. Just perform an article search.

Regards,

1 solution

Code For Sending Message on Mobile


C#
HttpWebRequest webRequest = null;
string response = "";
byte[] bytes = Encoding.UTF8.GetBytes(xml);

try
{
    webRequest = (HttpWebRequest)WebRequest.Create("http://api.fastalerts.in/fastclient/SMSclient.php?username=" + senderusername + "&password=" + senderpwd + "&message=" + msg + "&numbers=" + phonenumber + "&senderid=" + senderid;);
    webRequest.ContentType = "application/x-www-form-urlencoded";
    webRequest.Method = "POST";
    webRequest.Timeout = 5000;

    webRequest.ContentLength = bytes.Length;
    using (Stream requeststream = webRequest.GetRequestStream())
    {
        requeststream.Write(bytes, 0, bytes.Length);
        requeststream.Close();
    }

    using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
    {
        using (StreamReader sr = new StreamReader(webResponse.GetResponseStream()))
        {
            response = sr.ReadToEnd().Trim();
            sr.Close();
        }
        webResponse.Close();
    }
}
catch(Exception ex)
{

}
return response;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900