1. Go to this page and download the library: Download milosp/mailer-sdk 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 Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->setSubject('test')
->setFrom('[email protected]')
->setTo([
'[email protected]'
])
->validate() // throws a MailerException - body isn't set
->getEmail();
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->setSubject('test')
->setFrom('[email protected]')
->setTo([
'[email protected]'
])
->setBodyTemplate('test-body-template')
->validate() // this passes validation - a template is used for the body
->getEmail();
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->setSubject('test')
->setFrom('[email protected]')
->setTo([
'[email protected]'
])
->setBody('<h1>This template uses variables: {{ var }}</h1>')
->setVariables([
'var' => 'some variable value'
])
->getEmail();
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->setEmailTemplate('some-email-template')
->getEmail();
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->setSubject('New subject') // this will override the template's subject
->setEmailTemplate('some-email-template')
->getEmail();
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->...
$mailer->emails->sendAsMessage($emailDto)
use Milos\MailerSdk\Dtos\EmailBuilder;
$emailDto = (new EmailBuilder())
->...
$mailer->emails->sendAsMessage($emailDto, 'your-exchange', 'your-routing-key')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.