1. Go to this page and download the library: Download daagmbh/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/ */
daagmbh / mailer example snippets
$mailer = new DaaMailer(
new SymfonyTemplateResolver($translator),
new TwigTemplateRenderer($twig),
$eventDispatcher
);
// Here you define the login data, the sending email address and the name of the sender for a specific locae
$mailer->registerSender('support', 'de_DE', new SmtpSender('smtp.googlemail.com', '[email protected]', 'password123', '[email protected]', 'Kundenservice'));
$mailer->registerSender('support', 'en_US', new SmtpSender('smtp.googlemail.com', '[email protected]', 'password123', '[email protected]', 'Service'));
use Daa\Library\Mail\Message\MessageInterface;
use Daa\Library\Mail\RecipientContainer;
class RegistrationMessage implements MessageInterface
{
private $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function getLocale()
{
return $this->user->getLocale();
}
public function getSenderId()
{
return 'support';
}
public function getRecipients()
{
return new RecipientContainer($this->user->getEmail());
}
public function getSubjectKey()
{
return 'user.registration.subject';
}
public function getTemplateKey()
{
return 'user.registration.text';
}
public function getParameters()
{
return ['user' => $this->user];
}
}
$message = new RegistrationMessage($user);
$mailer->sendMessage($message);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.