Difference between revisions of "Send SMS from your C"

From SMS Wiki
Jump to: navigation, search
(New page: Example code to send text messages written in C#. using System.Web.Mail; . . . string toPhoneNumber = "DestinationPhoneNumber"; string login = "YourUsername"; string password = "YourPa...)
 
 
Line 3: Line 3:
  
 
using System.Web.Mail;
 
using System.Web.Mail;
 +
 
.
 
.
 +
 
.
 
.
 +
 
.
 
.
 +
 
string toPhoneNumber = "DestinationPhoneNumber";
 
string toPhoneNumber = "DestinationPhoneNumber";
string login = "YourUsername";  
+
 
 +
string login = "YourUsername";
 +
 
string password = "YourPassword";
 
string password = "YourPassword";
 +
 
string compression = "Compression Option goes here - find out more";
 
string compression = "Compression Option goes here - find out more";
 +
 
string body = "Your Message";
 
string body = "Your Message";
 +
  
  
 
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
 
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
 +
 
mail.To = toPhoneNumber + "@sms.upsidewireless.com";
 
mail.To = toPhoneNumber + "@sms.upsidewireless.com";
mail.From = login + "@upsidewireless.com";
+
 
 +
mail.From = login + "@smtp.upsidewireless.com";
 +
 
 
mail.Subject = compression;
 
mail.Subject = compression;
 +
 +
 
mail.Body = body;
 
mail.Body = body;
 +
 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", login);  
+
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", login);
 +
 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);
  
  
System.Web.Mail.SmtpMail.SmtpServer = "smtp.upsidewireless.com";  
+
 
 +
System.Web.Mail.SmtpMail.SmtpServer = "smtp.upsidewireless.com";
 +
 
System.Web.Mail.SmtpMail.Send( mail );
 
System.Web.Mail.SmtpMail.Send( mail );
 +
 +
  
 
Note:
 
Note:
 
This implementation requires .Net Framework version 1.1 or higher.
 
This implementation requires .Net Framework version 1.1 or higher.

Latest revision as of 15:51, 19 February 2008

Example code to send text messages written in C#.


using System.Web.Mail;

.

.

.

string toPhoneNumber = "DestinationPhoneNumber";

string login = "YourUsername";

string password = "YourPassword";

string compression = "Compression Option goes here - find out more";

string body = "Your Message";


System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();

mail.To = toPhoneNumber + "@sms.upsidewireless.com";

mail.From = login + "@smtp.upsidewireless.com";

mail.Subject = compression;


mail.Body = body;

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", login);

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);


System.Web.Mail.SmtpMail.SmtpServer = "smtp.upsidewireless.com";

System.Web.Mail.SmtpMail.Send( mail );


Note: This implementation requires .Net Framework version 1.1 or higher.