tigusigalpa/mailru

MailRu for business SendBox service API

1.0.2 2019-10-10 15:56 UTC

This package is auto-updated.

Last update: 2024-05-18 03:10:06 UTC


README

PHP wrapper of Mail.Ru for business to work with the API. For the moment its only Sendbox integration. Official documentation https://help.mail.ru/biz/sendbox/api

mailru-for-business-logo

Install

Client side

  1. Add your domain to Mail.Ru. Approve domain via any available method: DNS TXT record or HTML file or HTML meta-tag or change domain NS records to mail.ru

  2. Configure domain MX-records. Keep only Mail.Ru backed MX-records:

    • Host/subdomain: @
    • Value: emx.mail.ru
    • Priority: 10
  3. Configure SPF-record (TXT domain record):

    • Host/subdomain: @
    • Value: v=spf1 redirect=_spf.mail.ru
    • TTL: 21600

    If you are using any paid services like SMTP, your SPF-record may be another but only single one. For example, if you are using an SMTP service, SPF (TXT) record will be v=spf1 include:send-box.ru include:smtp.send-box.ru redirect=_spf.mail.ru

  4. Configure DKIM signature. There may be a up to 3 DKIM records, depending on number of connected services.

  5. Get API credentials. Go to https://mailer.i.bizml.ru/settings/, select an API tab, activate REST API, copy ID (CLIENT ID) and Secret (CLIENT SECRET).

Developer side

$ composer require tigusigalpa/mailru
require_once 'vendor/autoload.php';

Sendbox

Email

$email = new \Tigusigalpa\MailRu\Sendbox\Email($client_id, $client_secret);

SMS

$sms = new \Tigusigalpa\MailRu\Sendbox\SMS($client_id, $client_secret);

SMTP

$smtp = new \Tigusigalpa\MailRu\Sendbox\SMTP($client_id, $client_secret);

Available methods

Name Arguments
sendEmail(array $email) $email = ['html' => (string), 'text' => (string), 'template' => ['id' => (int), 'variables' => (string)], 'subject' => (string)]

Coming soon...

PHPUnit tests

Use environment variables to test API:

  • CLIENT_ID (required)
  • CLIENT_SECRET (required)
  • TIMEOUT (optional)

All coverage tests are coming soon...

License

MIT License

Author

Igor Sazonov (sovletig@gmail.com)