实现手机发短信

using Microsoft.WindowsMobile.PocketOutlook;
        /// <summary>
        /// 发送短信       
        /// <param name="tell">手机号</param>
        /// <param name="dictate">内容</param>
        /// </summary>
        public static void SendCharge(string tell, string dictate)
        {
            try
            {
                //构造短信息对象
                OutlookSession ols = new OutlookSession();
                //发送信息
                SmsMessage sms = new SmsMessage(tell.Trim(),dictate.Trim());
                ols.SmsAccount.Send(sms);
                MessageBox.Show("your message has been send!", "send",
                    MessageBoxButtons.OK, MessageBoxIcon.Asterisk,
                    MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "send", MessageBoxButtons.OK, MessageBoxIcon.Asterisk,
                    MessageBoxDefaultButton.Button1);
            }
        }


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hxy2261/archive/2009/08/19/4464037.aspx

posted @ 2009-08-19 19:38  深沉哥  阅读(477)  评论(0编辑  收藏  举报