sendloop / mta-api-php
API client library for Sendloop MTA email as a service platform
Installs: 23 695
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 5
Forks: 2
Open Issues: 0
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2025-01-18 20:30:08 UTC
README
Sendloop MTA is a transaction email delivery gateway and this PHP SDK lets you to use API easily.
Quick Start
First, let's install the library with composer:
composer require sendloop/mta-api-php
Initialize the mailer with your API key:
require_once "vendor/autoload.php"; // Include composer autoloader
$mailer = new \Sendloop\MTA\Mailer("YOUR-API-KEY-HERE");
You can grab your API key from Settings > API Settings page on your Sendloop account.
After initializing the mailer, let's create a message:
$message = new \Sendloop\MTA\Message();
$message->setFrom("Sendloop Developers", "hello@sendloop.com");
$message->setReplyTo("Sendloop", "hello@sendloop.com");
$message->setSubject("Quick start guide to Sendloop MTA PHP SDK");
$message->setTextContent("...");
$message->setHTMLContent("...");
and send the message to our recipient with mailer:
$messageStatusID = $mailer->send("test@recipient.com", $message, ["custom_arg_1" => "my_test_value"]);
or send the message to our recipient with a name:
$messageStatusID = $mailer->send(["first last name", "test@recipient.com"], $message, ["custom_arg_1" => "my_test_value"]);
or send the message with personalization and options:
$messageStatusID = $mailer->send(
["first last name", "test@recipient.com"], // recipient
$message, // message
["custom_arg_1" => "my_test_value"], // custom args
[ // merge vars
"name" => "Recipient name",
"account_id" => 1,
"purchased" => true
],
[ // options
"TrackOpens" => true,
"TrackClicks" => true,
"TrackECommerce" => true,
"TrackGA" => true,
"Tags" => ["welcome_email", "to_user"],
"EmailID" => 1 // Draft ID
]
);
Later get the status of the delivery:
$statusDetails = $mailer->status($messageStatusID);
or get the status of the latest 50 deliveries:
$statusDetails = $mailer->status();