Commit 6bc3f282 authored by Mat's avatar Mat

Envoi réussi d'un premier mail

parent 55fde534
<?php
namespace PotageBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SendMailCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('potage:mail:send')
->setDescription("Envoie un biess mail !");
}
public $mailer;
/**
* SendMailCommand constructor.
*
* @param \Swift_Mailer $mailer
*/
public function __construct(\Swift_Mailer $mailer)
{
parent::__construct();
$this->mailer = $mailer;
}
/**
* Vérifie que les offres en cours n'ont pas expiré.
* Si c'est le cas, le statut est changé et un mail est envoyé aux maraichers.
*
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$message = (new \Swift_Message('Hello Email'))
->setFrom('postmaster@potage.domainepublic.site')
->setTo('mat@collectifs.net')
->setBody(
'coucou, ceci est un test', 'text/html'
)
;
$this->mailer->send($message);
$output->writeln('un mail envoyé');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment