1. Go to this page and download the library: Download leadm/leadmail library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use LeadM\LeadMail\Exceptions\LeadMailRequestException;
use LeadM\LeadMail\Exceptions\LeadMailConnectionException;
try {
LeadMail::sendEmail([...]);
} catch (LeadMailRequestException $e) {
$e->statusCode(); // e.g. 422, 502
$e->errorCode(); // e.g. "TRANSPORT_ERROR" (from the API envelope)
$e->logId(); // the email log id, when available
$e->validationErrors(); // ['from.email' => ['...']] on a 422
$e->isValidationError();
$e->isAuthenticationError();
} catch (LeadMailConnectionException $e) {
// Service unreachable — safe to queue and retry yourself.
}