Mailgun: A email service for developer

Mailgun:

Mailgun a powerful Apis that enable you to send receive and track email effortlessly.
Sdk available for different languages for more details like pricing and other checkout Mailgun website.

sdk of mailgun is available for different languages example codes on different languages are given below.

  • Curl

                
    curl -s --user 'api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0' \
    https://api.mailgun.net/v3/samples.mailgun.org/messages \
    -F from='Excited User <excited@samples.mailgun.org>' \
    -F to='devs@mailgun.net' \
    -F subject='Hello' \
    -F text='Testing some Mailgun awesomeness!'
                
    
  • Ruby

                
    def send_simple_message
    RestClient.post "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0"\
    "@api.mailgun.net/v3/samples.mailgun.org/messages",
    :from => "Excited User <excited@samples.mailgun.org>",
    :to => "devs@mailgun.net",
    :subject => "Hello",
    :text => "Testing some Mailgun awesomeness!"
    end
                
    
  • Python

                
    def send_simple_message():
    return requests.post(
    "https://api.mailgun.net/v3/samples.mailgun.org/messages",
    auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
    data={"from": "Excited User <excited@samples.mailgun.org>",
    "to": ["devs@mailgun.net"],
    "subject": "Hello",
    "text": "Testing some Mailgun awesomeness!"})
                
    
  • Php

                
    # Include the Autoloader (see "Libraries" for install instructions)
    require 'vendor/autoload.php';
    use Mailgun\Mailgun;
    
    # Instantiate the client.
    $mgClient = new Mailgun('key-3ax6xnjp29jd6fds4gc373sgvjxteol0');
    $domain = "samples.mailgun.org";
    
    # Make the call to the client.
    $result = $mgClient->sendMessage("$domain",
    array(  'from'    => 'Excited User <excited@samples.mailgun.org>',
            'to'      => 'Mailgun Devs <devs@mailgun.net>',
            'subject' => 'Hello',
            'text'    => 'Testing some Mailgun awesomeness!')
    );
                
    
  • Java

                
    # Try running this locally.
    public static ClientResponse SendSimpleMessage() {
        Client client = Client.create();
        client.addFilter(new HTTPBasicAuthFilter(
        "api","key-3ax6xnjp29jd6fds4gc373sgvjxteol0"));
        WebResource webResource = client.resource(
        "https://api.mailgun.net/v3/samples.mailgun.org/messages");
        MultivaluedMapImpl formData = new MultivaluedMapImpl();
        formData.add("from", "Excited User <excited@samples.mailgun.org>");
        formData.add("to", "devs@mailgun.net");
        formData.add("subject", "Hello");
        formData.add("text", "Testing some Mailgun awesomeness!");
        return webResource.type(MediaType.APPLICATION_FORM_URLENCODED).
        post(ClientResponse.class, formData);
    }
            
    
  • C#

            
    # Try running this locally.
    public static RestResponse SendSimpleMessage() {
        RestClient client = new RestClient();
        client.BaseUrl = "https://api.mailgun.net/v3";
        client.Authenticator = new HttpBasicAuthenticator(
        "api","key-3ax6xnjp29jd6fds4gc373sgvjxteol0");
        RestRequest request = new RestRequest();
        request.AddParameter("domain",
        "samples.mailgun.org", ParameterType.UrlSegment);
        request.Resource = "{domain}/messages";
        request.AddParameter("from", "Excited User <excited@samples.mailgun.org>");
        request.AddParameter("to", "devs@mailgun.net");
        request.AddParameter("subject", "Hello");
        request.AddParameter("text", "Testing some Mailgun awesomeness!");
        request.Method = Method.POST;
        return client.Execute(request);
    }supported languages are
        
    

Installing Mailgun on Ubuntu

    
# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add Mailgun as a dependency (x.x is the SDK version, see Github README below)
php composer.phar require mailgun/mailgun-php:~x.x
    

 

6 thoughts on “Mailgun: A email service for developer

  • September 26, 2016 at 1:27 pm
    Permalink

    Great post. I used to be checking continuously this blog and I’m
    inspired! Extremely helpful information specially the ultimate part 🙂 I care for such info a lot.

    I used to be seeking this particular information for a long time.
    Thank you and best of luck.

    Reply
    • September 26, 2016 at 1:56 pm
      Permalink

      Thanks buddy, i always try to write whatever i learn. will try best to update my blog on daily basis.

      Reply
  • September 27, 2016 at 5:32 am
    Permalink

    Oh my goodness! Amazing article dude! Thanks, However I am having troubles with your RSS.
    I don’t understand the reason why I can’t subscribe to it.
    Is there anyone else having the same RSS problems?
    Anyone that knows the solution can you kindly respond?
    Thanks!!

    Reply
    • September 27, 2016 at 6:57 am
      Permalink

      Hi i just try with my chrome extention it is working fine please try with it.

      Reply
  • October 6, 2016 at 4:26 am
    Permalink

    After looking into a number of the blog posts on your
    website, I honestly like your technique of blogging.

    I bookmarked it to my bookmark website list and will be checking back
    soon. Please visit my website as well and let me know
    your opinion.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *