Skip to content

Instantly share code, notes, and snippets.

View danielpotthast's full-sized avatar

Daniel Potthast danielpotthast

View GitHub Profile
swiftmailer:
transport: gmail
username: [email protected]
password: myGmailPassword
swiftmailer:
disable_delivery: true
$newsletterManager = $this->get('newsletter_manager');
$newsletterManager->send($recipients, $message);
<?php
class Newsletter
{
private $mailer;
public function __construct()
{
$this->mailer = new Mailer('[email protected]','Demo News','Reply-To: [email protected]');
}
<?php
namespace Demo;
class NewsletterManager
{
private $mailer;
public function setMailer(MailerInterface $mailer)
{
<?php
namespace Tests\Demo;
use Demo\MailerInterface;
use Demo\Message;
use Demo\NewsletterManager;
class NewsletterManagerTest extends \PHPUnit_Framework_TestCase
{
parameters:
mailer.transport: sendmail
services:
mailer: sendmail
class: Mailer
arguments: ['%mailer.transport%']
newsletter_manager:
class: NewsletterManager
calls:
- [setMailer‚ ['@mailer']]
<?php
class Newsletter
{
private $mailer;
public function __construct()
{
$this->mailer = new Mailer('[email protected]','Demo News','Reply-To: [email protected]');
}