Sending Automated SMS Messages

前端 未结 7 1647
独厮守ぢ
独厮守ぢ 2021-02-09 15:20

First, we use .net & sql server.

I have a client that is interested in a system that will send SMS messages at scheduled times.

I have never done anything li

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-09 16:09

    :)

    Here's something that I whipped up that seems to be working well:

        public static void SendSMS(string from, string number, string subject, string message, SmtpClient smtp)
        {
            long.Parse(number);
    
            List domains = new List(
                "{N}.iws@iwspcs.net,{N}@airtelap.com,{N}@airtelkk.com,{N}@alertas.personal.com.ar,{N}@bplmobile.com,{N}@cingularme.com,{N}@clarotorpedo.com.br,{N}@comcel.com.co,{N}@cwemail.com,{N}@email.uscc.net,{N}@emtelworld.net,{N}@fido.ca,{N}@gocbw.com,{N}@gsm.sunrise.ch,{N}@ideasclaro-ca.com,{N}@iwirelesshometext.com,{N}@message.alltel.com,{N}@messaging.nextel.com,{N}@messaging.sprintpcs.com,{N}@mmode.com,{N}@mms.att.net,{N}@mms.bouyguestelecom.fr,{N}@mms.mymeteor.ie,{N}@mobile.celloneusa.com,{N}@mobiletxt.ca,{N}@movistar.com.co,{N}@msg.acsalaska.com,{N}@msg.gci.net,{N}@msg.globalstarusa.com,{N}@msg.iridium.com,{N}@msg.telus.com,{N}@msgnextel.com.mx,{N}@myboostmobile.com,{N}@myhelio.com,{N}@mymetropcs.com,{N}@page.att.net,{N}@page.nextel.com,{N}@pcs.rogers.com,{N}@qwestmp.com,{N}@sms.co.za,{N}@sms.ctimovil.com.ar,{N}@sms.mobitel.lk,{N}@sms.mycricket.com,{N}@sms.sasktel.com,{N}@sms.tigo.com.co,{N}@sms.t-mobile.at,{N}@text.aql.com,{N}@text.mtsmobility.com,{N}@tmomail.net,{N}@tms.suncom.com,{N}@torpedoemail.com.br,{N}@txt.att.net,{N}@txt.bell.ca,{N}@txt.bellmobility.ca,{N}@utext.com,{N}@vmobile.ca,{N}@vmobl.com,{N}@voda.co.za,{N}@vtext.com,+48{N}@text.plusgsm.pl,297+{N}@mas.aw,977{N}@sms.spicenepal.com,{N}@orange.pl,TwoWay.11{N}@nextel.net.ar,{N}@mmst5.tracfone.com"
                .Replace("{N}", number).Split(','));
    
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress(from);
            mail.Subject = subject;
            mail.Body = message;
            domains.ForEach(d => mail.Bcc.Add(d)); 
    
            smtp.Send(mail);
        }
    

    Domains were obtained from here.

    Update

    Use https://www.twilio.com/.

提交回复
热议问题