private void button1_Click(object sender, EventArgs e) { ESMSWS.user user = new ESMSWS.user(); ESMSWS.alias alias = new ESMSWS.alias(); user.username = "******"; user.password = "******"; alias.alias1 = "SLCMS"; smsMessage msg = new smsMessage(); msg.sender = alias; msg.message = body.Text; msg.recipients = new string[] { recipient.Text }; EnterpriseSMSWSClient client = new EnterpriseSMSWSClient(); session s = client.createSession(user); int test = client.sendMessages(s, msg); // smsMessage[] deliveryReports=client.getDeliveryReports(s, alias); //if(deliveryReports==null)Console.WriteLine("NULL"); // for (int i = 0; i < deliveryReports.GetLength(1); i++) // { // System.Diagnostics.Debug.WriteLine(deliveryReports[i].message); // } }
public bool SendSMSSriLanka(string mobileNumber, string message) { try { EMMS.user objuser = new EMMS.user(); EMMS.alias alias = new EMMS.alias(); objuser.username = user; objuser.password = password; alias.alias1 = "APL_ENERGY"; smsMessage msg = new smsMessage(); msg.sender = alias; msg.message = message; if (mobileNumber.Contains(",")) { msg.recipients = mobileNumber.Split(',').ToArray(); } else { msg.recipients = new string[] { mobileNumber } }; EnterpriseSMSWSClient client = new EnterpriseSMSWSClient(); session s = client.createSession(objuser); int result = client.sendMessages(s, msg); client.closeSession(s); if (result == 200) { return(true); } else { return(false); } } catch (Exception exp) { return(false); } }