Libraries and SDKs
We offer SDK and libraries for various programming languages to help you integrate Maileroo's APIs quickly and easily. These libraries handle authentication, request formatting, and error handling, allowing you to focus on building your application.
Available SDKs
PHP
Laravel
Node.js
Python
.NET
Go
Java
To read more about the PHP SDK, please click on the link below.
View on GitHub →Installation
composer require maileroo/maileroo-php-sdk
Quick Start
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Maileroo\MailerooClient;
use Maileroo\EmailAddress;
use Maileroo\Attachment;
// Initialize the client
$client = new MailerooClient('your-api-key');
// Send a basic email
$reference_id = $client->sendBasicEmail([
'from' => new EmailAddress('[email protected]', 'Sender Name'),
'to' => [new EmailAddress('[email protected]', 'Recipient Name')],
'subject' => 'Hello from Maileroo!',
'html' => '<h1>Hello World!</h1><p>This is a test email.</p>',
'plain' => 'Hello World! This is a test email.'
]);
echo "Email sent with reference ID: " . $reference_id;
To learn more about the Laravel Transport, please visit the GitHub repository.
View on GitHub →Installation
composer require maileroo/maileroo-laravel-transport
Configuration
Update your .env
file with your Maileroo API key and set the mailer to use Maileroo.
MAIL_MAILER=maileroo
MAILEROO_API_KEY=[YOUR_MAILEROO_API_KEY]
MAIL_FROM_ADDRESS="[YOUR_MAILEROO_FROM_ADDRESS]"
MAIL_FROM_NAME="[YOUR_MAILEROO_FROM_NAME]"
Usage
After configuring the transport, you can use Laravel's built-in mail functionality to send emails via Maileroo. There are no additional changes needed in your code.
To learn more about the Node.js SDK, please visit the npm package page.
View on npm →Installation
npm install maileroo-sdk
Quick Start
import {MailerooClient, EmailAddress, Attachment} from "maileroo-sdk";
const client = new MailerooClient("your-api-key");
const referenceId = await client.sendBasicEmail({
from: new EmailAddress("[email protected]", "Sender Name"),
to: [new EmailAddress("[email protected]", "Recipient Name")],
subject: "Hello from Maileroo!",
html: "<h1>Hello World!</h1><p>This is a test email.</p>",
plain: "Hello World! This is a test email."
});
console.log("Email sent with reference ID:", referenceId);
To learn more about the Python SDK, please visit the PyPI package page.
View on PyPI →Installation
pip install maileroo
Quick Start
from maileroo import MailerooClient, EmailAddress
# Initialize the client
client = MailerooClient("your-api-key")
# Send a basic email
reference_id = client.send_basic_email({
"from": EmailAddress("[email protected]", "Sender Name"),
"to": [EmailAddress("[email protected]", "Recipient Name")],
"subject": "Hello from Maileroo!",
"html": "<h1>Hello World!</h1><p>This is a test email.</p>",
"plain": "Hello World! This is a test email."
})
print("Email sent with reference ID:", reference_id)
To learn more about the .NET SDK, please visit the NuGet package page.
View on NuGet →Installation
dotnet add package Maileroo.DotNet.SDK
Quick Start
var apiKey = "YOUR_API_KEY";
var client = new MailerooClient(apiKey);
var from = new EmailAddress("[email protected]", "Your Company");
var to = new EmailAddress("[email protected]", "John Doe");
try
{
var payload = new Dictionary<string, object?>
{
["from"] = from,
["to"] = new List<EmailAddress> { to },
["subject"] = "Hello from Maileroo .NET 6",
["html"] = "<h1>Hello World</h1><p>This came from the C# SDK test.</p>",
["plain"] = "Hello World (plain text fallback)",
};
var refId = await client.SendBasicEmailAsync(payload);
Console.WriteLine($"Email queued! Reference ID: {refId}");
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
To learn more about the Golang SDK, please visit the GitHub repository.
View on GitHub →Installation
go get github.com/maileroo/maileroo-go-sdk
Quick Start
client, err := maileroo.NewClient("your-api-key", 30)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
htmlContent := "<h1>Test Email</h1><p>This is a test email from the Maileroo Go SDK.</p>"
plainContent := "Test Email\n\nThis is a test email from the Maileroo Go SDK."
referenceId, err := client.SendBasicEmail(context.Background(), maileroo.BasicEmailData{
From: maileroo.NewEmail("YOUR_EMAIL_ADDRESS", "Your Name"),
To: []maileroo.EmailAddress{
maileroo.NewEmail("RECIPIENT_EMAIL_ADDRESS", "Recipient Name"),
},
Cc: []maileroo.EmailAddress{
maileroo.NewEmail("CC_EMAIL_ADDRESS", "CC Name"),
},
Subject: "Test Email from Maileroo Go SDK",
HTML: &htmlContent,
Plain: &plainContent,
})
if err != nil {
log.Fatalf("Failed to send email: %v", err)
}
log.Printf("Email sent with reference ID: %s", referenceId)
To learn more about the Java SDK, please visit the Github repository or Maven Central.
Installation
Add the following dependency to your pom.xml
file:
<dependency>
<groupId>com.maileroo</groupId>
<artifactId>maileroo-java-sdk</artifactId>
<version>1.0.0</version>
</dependency>
Quick Start
import com.maileroo.*;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
MailerooClient client = new MailerooClient("your-api-key", Duration.ofSeconds(30));
Map<String,Object> email = new HashMap<>();
email.put("from", new EmailAddress("[email protected]", "Sender"));
email.put("to", new EmailAddress("[email protected]", "Recipient"));
email.put("subject", "Hello from Maileroo!");
email.put("html", "<h1>Hello World!</h1><p>This is a test email.</p>");
email.put("plain", "Hello World! This is a test email.");
String refId = client.sendBasicEmail(email);
System.out.println("Email sent with reference ID: " + refId);
}
}
Community Contributions
If you are interested in contributing SDKs or libraries at Maileroo, please create your GitHub repository and let us know. We will be happy to link to your repository from our documentation.