Overview
Complete API documentation for the Mailtrap email platform
Documentation structure
Quick Start
2
Install an SDK
npm install mailtrappip install mailtrapcomposer require railsware/mailtrap-phpgem install mailtrap<dependency>
<groupId>io.mailtrap</groupId>
<artifactId>mailtrap-java</artifactId>
<version>2.0.0</version>
</dependency>dotnet nuget add source https://nuget.pkg.github.com/mailtrap/index.json \
--name github-mailtrap \
--username GITHUB_USERNAME \
--password GITHUB_PATdotnet add package Mailtrap -s github-mailtrap3
Send your first email
import { MailtrapClient } from "mailtrap";
const mailtrap = new MailtrapClient({
token: process.env.MAILTRAP_API_KEY, // You can create your API key here https://mailtrap.io/api-tokens
});
mailtrap
.send({
from: { name: "Mailtrap Test", email: "[email protected]" },
to: [{ email: "[email protected]" }],
subject: "Hello from Mailtrap Node.js",
text: "Plain text body",
})
.then(console.log)
.catch(console.error);import mailtrap as mt
API_TOKEN = "<YOUR_API_TOKEN>" # your API key here https://mailtrap.io/api-tokens
client = mt.MailtrapClient(token=API_TOKEN)
# Create mail object
mail = mt.Mail(
sender=mt.Address(email="[email protected]", name="John Smith"),
to=[mt.Address(email="[email protected]")],
subject="You are awesome!",
text="Congrats for sending test email with Mailtrap!",
)
client.send(mail)Email Sending Options
Transactional emails
Bulk stream
Batch sending
Testing with Email Sandbox
How Sandbox works
Last updated
Was this helpful?

