1. Go to this page and download the library: Download jardisadapter/mailer 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/ */
jardisadapter / mailer example snippets
use JardisAdapter\Mailer\Mailer;
use JardisAdapter\Mailer\Config\SmtpConfig;
use JardisAdapter\Mailer\Data\MailMessage;
$mailer = new Mailer(new SmtpConfig(
host: 'smtp.example.com',
username: '[email protected]',
password: 'secret',
));
$message = MailMessage::create()
->withFrom('[email protected]', 'My App')
->withTo('[email protected]', 'Jane Doe')
->withSubject('Your Order Confirmation')
->withText('Thank you for your order #1234.')
->withHtml('<h1>Thank you!</h1><p>Your order #1234 has been confirmed.</p>');
$mailer->send($message);
$mailer = new Mailer(new SmtpConfig(
host: 'smtp.example.com',
maxRetries: 3, // Up to 3 retries
retryDelayMs: 200, // Exponential backoff: 200ms, 400ms, 800ms
));
use JardisSupport\Contract\Mailer\MailerExceptionInterface;
try {
$mailer->send($message);
} catch (MailerExceptionInterface $e) {
// Any mailer error
}
$mailer = new Mailer(
config: new SmtpConfig(host: 'localhost'),
transport: function (Envelope $envelope): void {
// Log, mock, or send via API
file_put_contents('/tmp/mail.log', $envelope->rawMessage);
},
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.