コード例 #1
0
        public void Send(string phoneNumber, CellularProvider provider, string subject, string msg)
        {
            var toEmail = GetSmsToEmail(phoneNumber, provider);

            //m_email.SendAsync(toEmail, subject, msg);
            m_email.Send(toEmail, subject, msg);
        }
コード例 #2
0
        /*
         * Alltel: [email protected].
         * AT&T: [email protected].
         * T-Mobile: [email protected].
         * Virgin Mobile: [email protected].
         * Sprint: [email protected].
         * Verizon: [email protected].
         * Nextel: [email protected].
         * US Cellular: [email protected].
         */
        // where phoneNumber like "3125139500"
        public string GetSmsToEmail(string phoneNumber, CellularProvider provider)
        {
            string smsEmail = null;

            switch (provider)
            {
            case CellularProvider.Alltel:
                smsEmail = string.Format("{0}@message.alltel.com", phoneNumber);
                break;

            case CellularProvider.ATT:
                smsEmail = string.Format("{0}@txt.att.net", phoneNumber);
                break;

            case CellularProvider.Tmobile:
                smsEmail = string.Format("{0}@tmomail.net", phoneNumber);
                break;

            case CellularProvider.VirginMobile:
                smsEmail = string.Format("{0}@vmobl.com", phoneNumber);
                break;

            case CellularProvider.Sprint:
                smsEmail = string.Format("{0}@messaging.sprintpcs.com", phoneNumber);
                break;

            case CellularProvider.Verizon:
                smsEmail = string.Format("{0}@vtext.com", phoneNumber);
                break;

            case CellularProvider.Nextel:
                smsEmail = string.Format("{0}@messaging.nextel.com", phoneNumber);
                break;

            case CellularProvider.USCellular:
                smsEmail = string.Format("{0}@mms.uscc.net", phoneNumber);
                break;
            }
            return(smsEmail);
        }