Giter Site home page Giter Site logo

email_sms_mms_gateways's People

Contributors

cubiclesoft avatar jjensen-ebsco avatar keenrivals avatar lewisdavidcole avatar mdale-ebsco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

email_sms_mms_gateways's Issues

Drop Japanese carriers?

Apparently Japan doesn't do e-mail to SMS, just e-mail. So, strictly speaking, the entries in this repo, while apparently valid, are just plain ol' e-mail address domains that get prefixed with the mobile phone number. Does it matter though since they are actually mobile carriers that they don't actually send a SMS to the recipient? IMO, the Wikipedia user who removed the entries is being overly pedantic with this change. Open to suggestions.

Deserialize in .NET

This was a little more effort than I anticipated, but here is the code in case anyone is interested. There may be a cleaner way to accomplish this without explicitly looping through each list, if so I'd be curious to see how.

I used Json.Net, credit to this site http://csharphelper.com/blog/2013/05/how-to-extract-only-some-of-the-information-from-a-json-file-in-c/ for some of the approach.

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

public Dictionary<string, CountryInfo> GetCarriers()
{
    // Get the data file.
    string jsonPath = @"your path here";
    string serialization = "";

    Dictionary<string, CountryInfo> Country = new Dictionary<string, CountryInfo>();
    Dictionary<string, Dictionary<string, CarrierInfo>> SMS_Carriers = new Dictionary<string,Dictionary<string,CarrierInfo>>();
    Dictionary<string, Dictionary<string, CarrierInfo>> MMS_Carriers = new Dictionary<string, Dictionary<string, CarrierInfo>>();

    StreamReader sr = File.OpenText(jsonPath);
    serialization = sr.ReadToEnd();

    Dictionary<string, object> dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(serialization);

    // Get the countries.
    Dictionary<string, string> countries = JsonConvert.DeserializeObject<Dictionary<string, string>>(dict["countries"].ToString());

    foreach (KeyValuePair<string, string> pair in countries)
    {
        CountryInfo country_info = new CountryInfo(pair.Key, (string)pair.Value, new List<CarrierInfo>(), new List<CarrierInfo>());
        Country.Add(country_info.CountryAbbreviation, country_info);
    }

    // Get the SMS carriers.
    Dictionary<string, Dictionary<string, string[]>> jsonCarriers = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string[]>>>(dict["sms_carriers"].ToString());

    foreach (string countryAbbr in jsonCarriers.Keys)
    {
        Dictionary<string, CarrierInfo> smscarriers = new Dictionary<string, CarrierInfo>();

        foreach (string carrierAbbr in jsonCarriers[countryAbbr].Keys)
        {
            CarrierInfo carrier = new CarrierInfo(jsonCarriers[countryAbbr][carrierAbbr][0], carrierAbbr, jsonCarriers[countryAbbr][carrierAbbr].Skip(1).ToList());
            smscarriers.Add(carrier.CarrierAbbreviation, carrier);
        }

        SMS_Carriers.Add(countryAbbr, smscarriers);
    }

    // Get the MMMS carriers
    jsonCarriers = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string[]>>>(dict["mms_carriers"].ToString());

    foreach (string countryAbbr in jsonCarriers.Keys)
    {
        Dictionary<string, CarrierInfo> MMScarriers = new Dictionary<string, CarrierInfo>();

        foreach (string carrierAbbr in jsonCarriers[countryAbbr].Keys)
        {
            CarrierInfo carrier = new CarrierInfo(jsonCarriers[countryAbbr][carrierAbbr][0], carrierAbbr, jsonCarriers[countryAbbr][carrierAbbr].Skip(1).ToList());
            MMScarriers.Add(carrier.CarrierAbbreviation, carrier);
        }

        MMS_Carriers.Add(countryAbbr, MMScarriers);
    }

    // Populate return object
    foreach (string countryAbbr in Country.Keys)
    {
        Country[countryAbbr].SMSCarriers.AddRange(SMS_Carriers[countryAbbr].Values.ToList());
        if (MMS_Carriers.ContainsKey(countryAbbr))
            Country[countryAbbr].MMSCarriers.AddRange(MMS_Carriers[countryAbbr].Values.ToList());
    }

    return Country;
}


public class CarrierInfo
{
    public string CarrierAbbreviation { get; set; }
    public string CarrierName { get; set; }
    public List<string> Emails { get; set; }

    public CarrierInfo(string carrierName, string carrierAbbreviation, List<string> emails)
    {
        CarrierName = carrierName;
        CarrierAbbreviation = carrierAbbreviation;
        Emails = emails;
    }

    public override string ToString()
    {
        return CarrierName;
    }
}


public class CountryInfo
{
    public string CountryAbbreviation {get; set;}
    public string CountryName { get; set; }
    public List<CarrierInfo> SMSCarriers { get; set; }
    public List<CarrierInfo> MMSCarriers { get; set; }

    public CountryInfo(string countryAbbreviation, string countryName, List<CarrierInfo> smsCarriers, List<CarrierInfo> mmsCarriers)
    {
        CountryAbbreviation = countryAbbreviation;
        CountryName = countryName;
        SMSCarriers = smsCarriers;
        MMSCarriers = mmsCarriers;
    }

    public override string ToString()
    {
        return CountryName;
    }
}

remove google voice gateway?

I'm not sure if the gateway for google voice has ever "officially" worked, but it appears to immediately fail with a message of "Delivery to the following recipient failed permanently:".

May be best to remove it from the list.

update Roger Wireless SMS & remove Ting

Per Roger Wireless - SMS should be @pcs.rogers.com

Your email address will be your 10-digit Rogers wireless phone number followed by @pcs.rogers.com. Example: [area code and phone number]@pcs.rogers.com

Per Ting Support - Email to text is not supported

IMPORTANT: Our network partners do not provide service level guarantees for email-to-SMS messaging delivery. As a result, the email-to-text functionality is unsupported on the Ting network. This service may not work correctly, or at all, with certain devices and/or conditions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.