Skip to content

Instantly share code, notes, and snippets.

@phpfour
Created February 18, 2017 06:44
Show Gist options
  • Save phpfour/4c3b8ae1659721cd0b983275e4b65fc1 to your computer and use it in GitHub Desktop.
Save phpfour/4c3b8ae1659721cd0b983275e4b65fc1 to your computer and use it in GitHub Desktop.
Symfony Email Test Script
<?php
use Symfony\Component\Debug\Debug;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();
$mailer = $kernel->getContainer()->get('mailer');
$message = \Swift_Message::newInstance()
->setSubject('Test Email')
->setFrom('emran.hasan@gmail.com')
->setTo('test@gmail.com')
->setBody('This is a test email.', 'text/html');
$mailer->send($message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment