unimails / unimail-php-sdk
php unimail sdk for accloud
1.1.0
2026-08-01 11:32 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
This package is auto-updated.
Last update: 2026-08-01 11:33:22 UTC
README
This is a Php SDK for Unimail. Quickly integrate into your project
Requirements
- php >= 7.2
- ext-curl
- ext-json
Usage
- install package
composer require unimails/unimail-php-sdk
- init a unimail client
you need a authorization key.
- example
<?php require_once __DIR__ . '/vendor/autoload.php'; use Unimails\UnimailPhpSdk\Client; use Unimails\UnimailPhpSdk\UnimailReq; $client = new Client('YOUR_UNIMAIL_KEY'); $client->setLanguage('en'); // test client connection; $client->checkConnect(); // send email $req = new UnimailReq(); $req->route = 'route'; $req->from = 'unimail'; $req->receivers = ['demo@example.com']; $req->subject = 'test'; $req->txtContent = "text content"; $req->htmlContent = '<h1>Hello</h1>'; $req->appendFile('attachment.txt', __DIR__ . '/tests/attachment.txt'); $result = $client->sendEmail($req); echo $result->toJson() . PHP_EOL;
API
- Client(key)
- client->setLanguage(lang): bool
- client->checkConnect(): bool
- client->sendEmail(UnimailReq): Result
support language
chinese is the default language for the sdk.
- english (en)
- simple chinese (zh)
- vietnamese (vi)
- idonesian (id)
- thai (th)
- gujarati (gu)
if you want to support other language, please open a issue.
- tips
If you want to use this SDK, please contact the author via admin@allcloud.top.