Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
6bc3f282
Commit
6bc3f282
authored
Aug 22, 2018
by
Mat
Browse files
Envoi réussi d'un premier mail
parent
55fde534
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Command/SendMailCommand.php
0 → 100755
View file @
6bc3f282
<?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é'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment