Skip to content
Snippets Groups Projects
Commit 0914b808 authored by Chip Cleary's avatar Chip Cleary Committed by Adam Shepherd
Browse files

Issue #3258208 by chipcleary, AdamPS: Simple examples to show the possibilities?

parent 73093c1d
No related branches found
No related merge requests found
langcode: en
status: true
dependencies: { }
dependencies: {}
id: symfony_mailer.test
configuration:
email_body:
content:
value: |-
<h4>You have mail</h4>
<p>This is a test email from <a href="[site:url]">[site:name]</a>.</p>
<p>Have a great <span class="day">{{ day }}</span>!</p>
<h4 class="text-small">
<a href="https://www.drupal.org/project/symfony_mailer">Drupal Symfony Mailer</a>
</h4>
format: email_html
email_subject:
value: 'Test email from [site:name]'
/**
* @file
* CSS used in emails provided by TestEmailBuilder
*/
h4 {
padding-top: 3px;
padding-bottom: 3px;
text-align: center;
background-color: #0678be;
color: white;
}
h4 > a {
color: white;
}
.text-small {
font-size: smaller;
}
......@@ -41,6 +41,16 @@ class TestEmailBuilder extends EmailBuilderBase {
if ($to = $email->getParam('to')) {
$email->setTo($to);
}
// - Add a custom CSS library. The library is defined in
// \Drupal\symfony_mailer\symfony_mailer.libraries.yml. The CSS is
// defined in \Drupal\symfony_mailer\css\test.email.css.
// - Set an parameter programmatically.
// The variable is used by the mailer policy which specifies the
// email title and body as defined in
// \Drupal\symfony_mailer\config\install\symfony_mailer.mailer_policy.symfony_mailer.test.yml.
$email->addLibrary('symfony_mailer/test')
->setVariable('day', date("l"));
}
}
test:
css:
theme:
css/test.email.css: {}
contact:
css:
theme:
......
......@@ -33,6 +33,8 @@ class TestEmailTest extends SymfonyMailerTestBase {
// Check that inline styles are preserved in the email.
// The padding is added in email-wrap.html.twig.
$this->assertBodyContains('style="padding: 0px 0px 0px 0px;"');
// This style comes from test.email.css.
$this->assertBodyContains('style="padding-top: 3px; padding-bottom: 3px; text-align: center; background-color: #0678be; color: white;"');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment