PHP code example of tomazahlin / symfony-mailer-bundle
1. Go to this page and download the library: Download tomazahlin/symfony-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/ */
tomazahlin / symfony-mailer-bundle example snippets
php
public function registerBundles()
{
$bundles = array(
// ...
new Ahlin\Bundle\MailerBundle\AhlinMailerBundle(),
);
}
php
namespace Company\App;
use Ahlin\Mailer\MailingInterface;
class MyService
{
private $mailing;
public function __construct(MailingInterface $mailing)
{
$this->mailing = $mailing;
}
public function doSomething()
{
// How to access factory to create mail instances
$factory = $this->mailing->getFactory();
// How to access mailer to send or queue the mail
$mailer = $this->mailing->getMailer();
}
}