Email API - Email Marketing - SMTP services - Mailjet

API For All Your Email Needs

From transactional email to marketing campaign, discover how easy it is to build and deliver beautifully responsive email at scale.

# This call sends an email to one recipient, using a validated sender address
# Do not forget to update the sender address used in the sample
curl -s \
  -X POST \
  --user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
  https://api.mailjet.com/v3/send \
  -H 'Content-Type: application/json' \
  -d '{
    "FromEmail":"pilot@mailjet.com",
    "FromName":"Mailjet Pilot",
    "Subject":"Your email flight plan!",
    "Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
    "Html-part":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
    "Recipients":[
        {
            "Email": "passenger@mailjet.com"
        }
    ]
  }'


<?php
/**
* This call sends an email to one recipient, using a validated sender address
* Do not forget to update the sender address used in the sample
*/

use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));
$body = [
    'FromEmail' => "pilot@mailjet.com",
    'FromName' => "Mailjet Pilot",
    'Subject' => "Your email flight plan!",
    'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
    'Html-part' => "<h3>Dear passenger, welcome to Mailjet!</h3><br/>May the delivery force be with you!",
    'Recipients' => [
        [
            'Email' => "passenger@mailjet.com"
        ]
    ]
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
$response->success() && var_dump($response->getData());


/**
* This call sends an email to one recipient, using a validated sender address
* Do not forget to update the sender address used in the sample
*/
var mailjet = require ('node-mailjet')
	.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)
var request = mailjet
	.post("send")
	.request({
		"FromEmail":"pilot@mailjet.com",
		"FromName":"Mailjet Pilot",
		"Subject":"Your email flight plan!",
		"Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
		"Html-part":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
		"Recipients":[
				{
						"Email": "passenger@mailjet.com"
				}
		]
	});
request
	.on('success', function (response, body) {
		console.log (response.statusCode, body);
	})
	.on('error', function (err, response) {
		console.log (response.statusCode, err);
	});

# This call sends an email to one recipient, using a validated sender address
# Do not forget to update the sender address used in the sample
Mailjet.configure do |config|
  config.api_key = ENV['MJ_APIKEY_PUBLIC']
  config.secret_key = ENV['MJ_APIKEY_PRIVATE']
  config.default_from = 'your default sending address'
end
variable = Mailjet::Send.create(
    from_email: "pilot@mailjet.com",
    from_name: "Mailjet Pilot",
    subject: "Your email flight plan!",
    text_part: "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
    html_part: "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
    recipients: [{ 'Email'=> 'passenger@mailjet.com'}]
)

"""
This call sends an email to one recipient, using a validated sender address
Do not forget to update the sender address used in the sample
"""
from mailjet 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))
data = {
  'FromEmail': 'pilot@mailjet.com',
  'FromName': 'Mailjet Pilot',
  'Subject': 'Your email flight plan!',
  'Text-part': 'Dear passenger, welcome to Mailjet! May the delivery force be with you!',
  'Html-part': '<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!',
  'Recipients': [
				{
						"Email": "passenger@mailjet.com"
				}
		]
}
result = mailjet.send.create(data=data)

/**
 * This call sends an email to one recipient, using a validated sender address
 * Do not forget to update the sender address used in the sample
 */

package MyClass;

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.resource.Email;
import org.json.JSONArray;
import org.json.JSONObject;

public class MyClass {

    public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
      MailjetClient client;
      MailjetRequest request;
      MailjetResponse response;
      client = new MailjetClient("api key", "api secret");
      request = new MailjetRequest(Email.resource)
                        .property(Email.FROMEMAIL, "pilot@mailjet.com")
                        .property(Email.FROMNAME, "Mailjet Pilot")
                        .property(Email.SUBJECT, "Your email flight plan!")
                        .property(Email.TEXTPART, "Dear passenger, welcome to Mailjet! May the delivery force be with you!")
                        .property(Email.HTMLPART, "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!")
                        .property(Email.RECIPIENTS, new JSONArray()
                .put(new JSONObject()
                    .put("Email", "passenger@mailjet.com")));
      response = client.post(request);
      System.out.println(response.getData());
    }
}

/*
* This call sends an email to one recipient, using a validated sender address
* Do not forget to update the sender address used in the sample
*/

package main
import (
    "fmt"
    . "github.com/mailjet/mailjet-apiv3-go"
    "os"
)
func main () {
    mailjetClient := NewMailjetClient(os.Getenv("MJ_APIKEY_PUBLIC"), os.Getenv("MJ_APIKEY_PRIVATE"))
    email := &InfoSendMail {
      FromEmail: "pilot@mailjet.com",
      FromName: "Mailjet Pilot",
      Subject: "Your email flight plan!",
      TextPart: "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
      HTMLPart: "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
      Recipients: []Recipient {
        Recipient {
          Email: "passenger@mailjet.com",
        },
      },
    }
    res, err := mailjetClient.SendMail(email)
    if err != nil {
            fmt.Println(err)
    } else {
            fmt.Println("Success")
            fmt.Println(res)
    }
}
using Mailjet.Client;
using Mailjet.Client.Resources;
using System;
using Newtonsoft.Json.Linq;
namespace Mailjet.ConsoleApplication
{
    class Program
    {
        /// 
        /// This calls sends a message to one recipient with a CustomID
        /// 
        static void Main(string[] args)
        {
            RunAsync().Wait();
        }
        static async Task RunAsync()
        {
            MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable("MJ_APIKEY_PUBLIC"), Env
            MailjetRequest request = new MailjetRequest
            {
                Resource = Send.Resource,
            }
                .Property(Send.FromEmail, "pilot@mailjet.com")
                .Property(Send.FromName, "Mailjet Pilot")
                .Property(Send.Subject, "Your email flight plan!")
                .Property(Send.TextPart, "Dear passenger, welcome to Mailjet! May the delivery force be with you
                .Property(Send.HtmlPart, "<h3>Dear passenger, welcome to Mailjet!</h3><br />Ma
                .Property(Send.Recipients, new JArray {
                    new JObject {
                    {"Email", "passenger@mailjet.com"}
                    }
                    });
            MailjetResponse response = await client.PostAsync(request);
            if (response.IsSuccessStatusCode)
            {
                Console.WriteLine(string.Format("Total: {0}, Count: {1}\n", response.GetTotal(), response.GetCou
                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(string.Format("ErrorMessage: {0}\n", response.GetErrorMessage()));
            }
        }
    }
}

    
Sign Up For Free

Advanced Transactional Suite

Created with Sketch.
Created with Sketch.

Robust Delivery Service

Where scalable sending infrastructure meets optimal deliverability. Quickly integrate with our SMTP relay or Send API and start sending in minutes. View More

Created with Sketch.
Created with Sketch.

Dynamic Templating Language

Build faster with our best-in-class template engine and templating language. With just a few templates, easily adapt your message content and layout to each recipient with loops and conditions View More

Created with Sketch.
Created with Sketch.

Effortless Template Collaboration

Quickly build your transactional template with our drag-and-drop visual editor, Passport, and have your marketing teammate push design and content update without your coding support. View More

Created with Sketch.
Created with Sketch.

Mailjet Real-time Monitoring

Worrying about noticing any delivery issue with your business critical transactional email too late? Simply monitor key sending indicators with alerts and address any delivery issues as soon as they arise. View More

Marketing Campaigns
Connect. Request. Sent.

Created with Sketch.
Created with Sketch.

No More Outdated Contacts

Quickly synchronize your contacts, contact properties and contact lists from different systems you are already using with our Contact Lists API. View More

Created with Sketch.
Created with Sketch.

Plug and Play Campaign Routing

Set up and schedule your email campaigns with our Campaign API directly from your own system. Let our campaign engine do the hard work of routing your marketing email to the inbox. View More

Tracking and Analytics

Track your email performance real-time is straightforward with our Event API. Alternatively, pull insights from your email activity with Statistics API whenever you need it.

Event API

Enjoy Coding Responsive Email Templates

Forget about the complexity of building responsive HTML email. Code twice as fast with MJML, the most popular open source email framework created by Mailjet. The best part - you get to edit and manage all your MJML templates in Passport, our visual template builder!

The Magic of MJML

One Click Integration

Our API integrates with 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 Zone

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 API

Head over to our blog and learn more about how Mailjet API 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 © 2016 Mailjet inc. All Rights Reserved.

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