sendloop/mta-api-php
最新稳定版本:1.2.0
Composer 安装命令:
composer require sendloop/mta-api-php
包简介
API client library for Sendloop MTA email as a service platform
README 文档
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();
统计信息
- 总下载量: 27.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-12-07