Free Powerful And Simple Email Solutions For Developers - Mailjet

Complete Email Solutions For Developers

Mailjet sends nearly 2 billion emails every month, and thousands of companies in over 150 countries use our solutions every day...
Trust the European leader in emailing and discover a reliable solution designed with developers in mind, with code examples and step-by-step documentation. Simple to integrate and lightning fast, Mailjet will power all your email needs.

# This call sends a message to one recipient.
curl -s \
	-X POST \
	--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
	https://api.mailjet.com/v3.1/send \
	-H 'Content-Type: application/json' \
	-d '{
		"Messages":[
            {
				"From": {
					"Email": "pilot@mailjet.com",
					"Name": "Mailjet Pilot"
				},
				"To": [
			    	{
				    	"Email": "passenger1@mailjet.com",
						"Name": "passenger 1"
					}
				],
				"Subject": "Your email flight plan!",
				"TextPart": "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
				"HTMLPart": "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"
			}
		]
	}'


        
<?php
/*
This call sends a message to one recipient.
*/
require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'),true,['version' => 'v3.1']);
$body = [
    'Messages' => [
        [
            'From' => [
                'Email' => "pilot@mailjet.com",
                'Name' => "Mailjet Pilot"
            ],
            'To' => [
                [
                    'Email' => "passenger1@mailjet.com",
                    'Name' => "passenger 1"
                ]
            ],
            'Subject' => "Your email flight plan!",
            'TextPart' => "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
            'HTMLPart' => "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"
        ]
    ]
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
$response->success() && var_dump($response->getData());
?>

        
/**
 *
 * This call sends a message to one recipient.
 *
 */
const mailjet = require ('node-mailjet')
	.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)
const request = mailjet
	.post("send", {'version': 'v3.1'})
	.request({
		"Messages":[
            {
			    "From": {
					"Email": "pilot@mailjet.com",
					"Name": "Mailjet Pilot"
				},
				"To": [
					{
						"Email": "passenger1@mailjet.com",
						"Name": "passenger 1"
					}
				],
				"Subject": "Your email flight plan!",
				"TextPart": "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
				"HTMLPart": "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"
			}
		]
	})
request
	.then((result) => {
		console.log(result.body)
	})
	.catch((err) => {
		console.log(err.statusCode)
	})
        
# This call sends a message to one recipient.
require 'mailjet'
Mailjet.configure do |config|
  config.api_key = ENV['MJ_APIKEY_PUBLIC']
  config.secret_key = ENV['MJ_APIKEY_PRIVATE']
  config.api_version = "v3.1"
end
variable = Mailjet::Send.create(messages: [{
    'From'=> {
        'Email'=> 'pilot@mailjet.com',
        'Name'=> 'Mailjet Pilot'
    },
    'To'=> [
        {
            'Email'=> 'passenger1@mailjet.com',
            'Name'=> 'passenger 1'
        }
    ],
    'Subject'=> 'Your email flight plan!',
    'TextPart'=> 'Dear passenger 1, welcome to Mailjet! May the delivery force be with you!',
    'HTMLPart'=> '<h3>Dear passenger 1, welcome to Mailjet!</h3>≷br/>May the delivery force be with you!'
}]
)
p variable.attributes['Messages']
        
"""
This call sends a message to one recipient.
"""
from mailjet_rest import Client
import os
api_key = os.environ['MJ_APIKEY_PUBLIC']
api_secret = os.environ['MJ_APIKEY_PRIVATE']
mailjet = Client(auth=(api_key, api_secret), version='v3.1')
data = {
    'Messages': [
	    {
			"From": {
				"Email": "pilot@mailjet.com",
				"Name": "Mailjet Pilot"
			},
			"To": [
				{
					"Email": "passenger1@mailjet.com",
					"Name": "passenger 1"
				}
			],
			"Subject": "Your email flight plan!",
			"TextPart": "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
			"HTMLPart": "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"
		}
	]
}
result = mailjet.send.create(data=data)
print result.status_code
print result.json()

        
package com.my.project;
import com.mailjet.client.errors.MailjetException;
import com.mailjet.client.errors.MailjetSocketTimeoutException;
import com.mailjet.client.MailjetClient;
import com.mailjet.client.MailjetRequest;
import com.mailjet.client.MailjetResponse;
import com.mailjet.client.ClientOptions;
import com.mailjet.client.resource.Emailv31;
import org.json.JSONArray;
import org.json.JSONObject;
public class MyClass {
    /**
    * This call sends a message to one recipient.
    */
    public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
        MailjetClient client;
        MailjetRequest request;
        MailjetResponse response;
        client = new MailjetClient( System.getenv("MJ_APIKEY_PUBLIC"), System.getenv("MJ_APIKEY_PRIVATE"), new ClientOptions("v3.1"));
        request = new MailjetRequest(Emailv31.resource)
            .property(Emailv31.MESSAGES, new JSONArray()
                .put(new JSONObject()
                    .put(Emailv31.Message.FROM, new JSONObject()
                        .put("Email", "pilot@mailjet.com")
                        .put("Name", "Mailjet Pilot"))
                    .put(Emailv31.Message.TO, new JSONArray()
                        .put(new JSONObject()
                            .put("Email", "passenger1@mailjet.com")
                            .put("Name", "passenger 1")))
                    .put(Emailv31.Message.SUBJECT, "Your email flight plan!")
                    .put(Emailv31.Message.TEXTPART, "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!")
                    .put(Emailv31.Message.HTMLPART, "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!")));
        response = client.post(request);
        System.out.println(response.getStatus());
        System.out.println(response.getData());
    }
}

        
/*
This call sends a message to one recipient.
*/
package main
import (
	"fmt"
	"log"
	"os"
	mailjet "github.com/mailjet/mailjet-apiv3-go"
)
func main () {
	mailjetClient := NewMailjetClient(os.Getenv("MJ_APIKEY_PUBLIC"), os.Getenv("MJ_APIKEY_PRIVATE"))
	messagesInfo := []mailjet.InfoMessagesV31 {
        mailjet.InfoMessagesV31{
            From: &mailjet.RecipientV31{
                Email: "pilot@mailjet.com",
                Name: "Mailjet Pilot",
            },
            To: &mailjet.RecipientsV31{
                mailjet.RecipientV31 {
                    Email: "passenger1@mailjet.com",
                    Name: "passenger 1",
                },
            },
            Subject: "Your email flight plan!",
            TextPart: "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
            HTMLPart: "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!",
        },
    }
	messages := mailjet.MessagesV31{Info: messagesInfo }
	res, err := m.SendMailV31(&messages)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Data: %+v\n", res)
}
        
using Mailjet.Client;
using Mailjet.Client.Resources;
using System;
using Newtonsoft.Json.Linq;
namespace Mailjet.ConsoleApplication
{
    class Program
    {
        /// 
        /// This call sends a message to one recipient.
        /// 
        static void Main(string[] args)
        {
            RunAsync().Wait();
        }
        static async Task RunAsync()
        {
            MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable("MJ_APIKEY_PUBLIC"), Environment.GetEnvironmentVariable("MJ_APIKEY_PRIVATE"))
            {
                Version = ApiVersion.V3_1,
            };
            MailjetRequest request = new MailjetRequest
            {
                Resource = Send.Resource,
            }
            .Property(Send.Messages, new JArray {
                new JObject {
                    {"From", new JObject {
                        {"Email", "pilot@mailjet.com"},
                        {"Name", "Mailjet Pilot"}
                    }},
                    {"To", new JArray {
                        new JObject {
                            {"Email", "passenger1@mailjet.com"},
                            {"Name", "passenger 1"}
                        }
                    }},
                    {"Subject", "Your email flight plan!"},
                    {"TextPart", "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!"},
                    {"HTMLPart", "<h3>Dear passenger 1, welcome to Mailjet!</h3><br/>May the delivery force be with you!"}
                }
            });
            MailjetResponse response = await client.PostAsync(request);
            if (response.IsSuccessStatusCode)
            {
                Console.WriteLine(string.Format("Total: {0}, Count: {1}\n", response.GetTotal(), response.GetCount()));
                Console.WriteLine(response.GetData());
            }
            else
            {
                Console.WriteLine(string.Format("StatusCode: {0}\n", response.StatusCode));
                Console.WriteLine(string.Format("ErrorInfo: {0}\n", response.GetErrorInfo()));
                Console.WriteLine(response.GetData());
                Console.WriteLine(string.Format("ErrorMessage: {0}\n", response.GetErrorMessage()));
            }
        }
    }
}

    
Sign Up For Free

Send Your Emails With Confidence

Created with Sketch.

Robust and reliable delivery

Leverage the power of our robust infrastructure. Our seven data centers (located in France, United Kingdom, Belgium and Germany and US), comprising 150 physical servers and 700 virtual instances, allow us to send tens of millions of emails every day. View More

Created with Sketch.

Quick and simple integration

Integrating with our SMTP relay or our Send API is fast and simple. Read our documentation to send your first email in just a few minutes. Read our documentation

Created with Sketch.
Created with Sketch.

Real-Time Monitoring

Create your own alerts based on the criticality of your emails, and be notified immediately if there’s a problem with the delivery of your transactional emails. More about Real-Time Monitoring

Created with Sketch.

Compliance with European regulations

Mailjet hosts all of its customer data in Europe and complies with European directives and regulations on the protection of personal data. More about GDPR

Create And Personalize Your email In Minutes

Created with Sketch.

Powerful Templating Language

Build emails faster with our best-in-class template engine and templating language. Use just a few templates and easily adapt the layout and content of your message to each recipient with loops and conditions. Learn more about our Templating Language

Created with Sketch.

Template Collaboration Made Easy

Quickly build your transactional template with our drag-and-drop visual editor, Passport, and allow the Marketing team to update design and content without further coding. More about Passport

Extensive Documentation

Learn how to set up and call our API by using our step-by-step documentation

Read our documentation

Build Responsive Templates Twice As Fast

Forget about the complexity of developing responsive emails in HTML. Code twice as fast with MJML, the open source framework created by Mailjet. Templates created in MJML are compatible with Passport, our intuitive email editor, so you can import them and modify them in drag-and-drop.

More about MJML

Simple Integration

Our API integrates with the most popular programming languages and frameworks: PHP, Ruby, NodeJS, Python, C#, Java and Go. Start sending with us in just few lines of code.

Developer area

Hassle-Free Inbound Processing

Enable direct interaction with your customers through email parsing. Our platform extracts information from incoming email into JSON data structure so you can automate business processes.

Parse API

Go Further With Mailjet’s Developer Solutions

Head over to our blog and learn more about how Mailjet can help you achieve more with email.

Templating Language + MJML: How To Code A Personalized Digest Email

Meet our Brand New Send API

Introducing Mailjet's Dedicated API Support

Made with in Paris © 2017 Mailjet inc. All Rights Reserved.

Terms & Conditions and Legal Notices - Privacy Policy - Sending Policy
Contact us