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
75fd4d06
Commit
75fd4d06
authored
Aug 22, 2018
by
Mat
Browse files
Quelques essais de styles html dans un mail
parent
44f8c12c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Command/SendMailCommand.php
View file @
75fd4d06
...
...
@@ -37,6 +37,10 @@ class SendMailCommand extends ContainerAwareCommand
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
...
...
src/PotageBundle/Controller/DefaultController.php
View file @
75fd4d06
...
...
@@ -18,6 +18,9 @@ class DefaultController extends MasterController
/**
* @param Newsletter $newsletter
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/
public
function
testAction
(
Newsletter
$newsletter
)
{
...
...
src/PotageBundle/Resources/views/Mail/bodyMail.html.twig
View file @
75fd4d06
...
...
@@ -3,9 +3,25 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
Document
</title>
<style>
body
{
background-color
:
#bfd5e0
;
color
:
#672126
;
padding
:
3em
;
}
.brand
{
background-color
:
#2d2a2a
;
padding
:
1em
;
}
.brand
span
{
color
:
white
;
font-size
:
1.25rem
;
margin-bottom
:
10px
;
}
.brand
img
{
height
:
40px
;
}
</style>
</head>
<body>
<div
class=
"brand"
>
{# ne marche pas en local car http://localhost
<img src="{{ absolute_url(asset('css/img/radis.1inv.png')) }}" alt="logo">
#}
<img
src=
"http://potage.domainepublic.site/web/css/img/radis.1inv.png"
alt=
"logo absolu"
>
<span>
Potage
</span>
</div>
<h1>
Mon template twig
</h1>
<h2>
{{
subject
}}
</h2>
<h3>
{{
to
}}
</h3>
{{
body
}}
</body>
</html>
\ No newline at end of file
src/PotageBundle/Services/Newsletter.php
View file @
75fd4d06
...
...
@@ -34,7 +34,9 @@ class Newsletter
$mailer
=
$this
->
container
->
get
(
'mailer'
);
$twig
=
$this
->
container
->
get
(
'twig'
);
// Destinataire, l'application elle-même
$from
=
[
'postmaster@potage.domainepublic.site'
=>
'Potage'
];
$message
=
(
new
\
Swift_Message
())
->
setFrom
(
$from
)
...
...
@@ -43,7 +45,8 @@ class Newsletter
->
setBody
(
$twig
->
render
(
'@Potage/Mail/bodyMail.html.twig'
,
array
(
'body'
=>
$body
,
'name'
=>
'coucou'
'to'
=>
$to
,
'subject'
=>
$subject
)),
'text/html'
);
...
...
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