Quickstart Guide to the Esendex .NET SDK

Sending a message with the MessagingService

The code sample below shows just how easy it is to send a messages using the MessagingService.

    EsendexCredentials credentials = new EsendexCredentials("username", "password");

    SmsMessage message = new SmsMessage("07000000000", "This is a test message...", "EX000000");

    MessagingService messagingService = new MessagingService(true, credentials);

    try
    {
        MessagingResult result = messagingService.SendMessage(message);

        Console.WriteLine("Message Batch Id: {0}", result.BatchId);

        foreach (ResourceLink messageId in result.MessageIds)
        {
            Console.WriteLine("Message Uri: {0}", messageId.Uri);
        }
    }
    catch (WebException ex)
    {
        Console.Write(ex.Message);
    }

Authenticating with the SessionService

The code sample below shows just how easily an Esendex Session can be constructed.

    EsendexCredentials credentials = new EsendexCredentials("username", "password");
    
    try
    {
        SessionService sessionService = new SessionService(Credentials);

        Credentials.SessionId = sessionService.CreateSession();
    }
    catch (WebException ex)
    {
        Console.Write(ex.Message);
    }

Accessing Esendex via a Proxy

The code sample below illustrates just how easy the Esendex SDK can be used from behind a proxy.

    WebProxy proxy = new WebProxy("http://myisasrvr01:8080");
    NetworkCredential credential = new NetworkCredential("domain_username", "domain_password");
    proxy.Credentials = credential;
    
    EsendexCredentials credentials = new EsendexCredentials("username", "password", proxy);

Last edited Mar 31, 2010 at 8:15 AM by Esendex, version 6

Comments

No comments yet.