1. Go to this page and download the library: Download visual-craft/mailer-bundle 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/ */
visual-craft / mailer-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new VisualCraft\Bundle\MailerBundle\VisualCraftMailerBundle(),
);
// ...
}
// ...
}
namespace AppBundle\MailType;
use VisualCraft\Bundle\MailerBundle\MailType\MailTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationMailType implements MailTypeInterface
{
public function configureOptions(OptionsResolver $optionsResolver)
{
// configure options which should be provided to buildMessage method
$optionsResolver->setRequired(['to']);
}
public function buildMessage(\Swift_Message $message, array $options)
{
// build message
$message
->setSubject('Registration')
->setTo($options['to'])
;
}
}