Send emails fast and with confidence through our easy to use REST API interface.
This is the API interface to the Mail Baby Mail services provided by InterServer. To use this service you must have an account with us at my.interserver.net.
In order to use most of the API calls you must pass credentials from the my.interserver.net site. We support several different authentication methods but the preferred method is to use the API Key which you can get from the Account Security page.
For more information, please visit https://www.mail.baby/contact/.
PHP 7.4 and later. Should also work with PHP 8.0.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/interserver/mailbaby-client-php.git"
}
],
"require": {
"interserver/mailbaby-client-php": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/MailBaby/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apiKeyAuth
$config = Interserver\Mailbaby\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Interserver\Mailbaby\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');
$apiInstance = new Interserver\Mailbaby\Api\BlockingApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$type = 'type_example'; // string | The type of deny rule.
$data = 'data_example'; // string | The content of the rule. If a domain type rule then an example would be google.com. For a begins with type an example would be msgid-. For the email typer an example would be [email protected].
$user = 'user_example'; // string | Mail account username that will be tied to this rule. If not specified the first active mail order will be used.
try {
$result = $apiInstance->addRule($type, $data, $user);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BlockingApi->addRule: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.mailbaby.net
Class | Method | HTTP request | Description |
---|---|---|---|
BlockingApi | addRule | POST /mail/rules | Creates a new email deny rule. |
BlockingApi | deleteRule | DELETE /mail/rules/{ruleId} | Removes an deny mail rule. |
BlockingApi | delistBlock | POST /mail/blocks/delete | Removes an email address from the blocked list |
BlockingApi | getMailBlocks | GET /mail/blocks | displays a list of blocked email addresses |
BlockingApi | getRules | GET /mail/rules | Displays a listing of deny email rules. |
HistoryApi | getStats | GET /mail/stats | displays a list of blocked email addresses |
HistoryApi | viewMailLog | GET /mail/log | displays the mail log |
SendingApi | sendAdvMail | POST /mail/advsend | Sends an Email with Advanced Options |
SendingApi | sendMail | POST /mail/send | Sends an Email |
ServicesApi | getMailOrders | GET /mail | displays a list of mail service orders |
StatusApi | pingServer | GET /ping | Checks if the server is running |
- DenyRuleNew
- DenyRuleRecord
- DenyRuleRecordAllOf
- EmailAddress
- GenericResponse
- GetMailOrders401Response
- GetStats200ResponseInner
- MailBlockClickHouse
- MailBlockRspamd
- MailBlocks
- MailLog
- MailLogEntry
- MailOrder
- SendMail
- SendMailAdv
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: X-API-KEY
- Location: HTTP header
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.1.0
- Package version:
1.0.0
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen