1. Go to this page and download the library: Download dam2k/ampmailer 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/ */
dam2k / ampmailer example snippets
use Dam2k\AmpMailer\Email;
use Dam2k\AmpMailer\Smtp\SmtpConfig;
use Dam2k\AmpMailer\Smtp\SmtpMailer;
use Dam2k\AmpMailer\Smtp\TlsMode;
$email = Email::new()
->from('Sender <[email protected]>')
->to('[email protected]')
->subject('Hello')
->text('Plain text body')
->html('<p>HTML body</p>')
->attachFile('/path/to/file.pdf');
$mailer = new SmtpMailer(new SmtpConfig(
host: 'smtp.example.com',
port: 587,
username: 'user',
password: 'secret',
tlsMode: TlsMode::StartTls,
));
$mailer->send($email);
use Dam2k\AmpMailer\Retry\RetryMailer;
use Dam2k\AmpMailer\Retry\RetryPolicy;
$mailer = new RetryMailer(
$mailer,
new RetryPolicy(maxAttempts: 3, initialDelay: 1.0),
);
use Dam2k\AmpMailer\RateLimit\InMemoryRateLimiter;
use Dam2k\AmpMailer\RateLimit\RateLimitedMailer;
$mailer = new RateLimitedMailer(
$mailer,
InMemoryRateLimiter::perSecond(5),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.