You are here

varbase_emails.html.twig in Varbase Email 9.0.x

Same filename and directory in other branches
  1. 8.6 templates/varbase_emails.html.twig

The default template file for e-mails.

Available variables:

  • subject: The subject.
  • body: The message content.
  • message: The $message array created and used in the mail building procedure. Its content varies between cases, but typically contains at least the following elements:

    • id: The message identifier.
    • module: The module that handles the building of the message.
    • key: The key of the message.
    • to: The recipient email address.
    • from: The email address of the sender.
    • langcode: The langcode to use to compose the e-mail.
    • params: The message parameters.

This template may be overriden by module and/or mail key, using any of the following template names:

  • swiftmailer.html.twig: global, used by default.
  • swiftmailer--mymodule.html.twig: only emails sent by the module "mymodule".
  • swiftmailer--mymodule--test.html.twig: only emails by the module "mymodule" with key "test".

See also

template_preprocess()

template_preprocess_swiftmailer()

File

templates/varbase_emails.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * The default template file for e-mails.
  5. *
  6. * Available variables:
  7. * - subject: The subject.
  8. * - body: The message content.
  9. * - message: The $message array created and used in the mail building
  10. * procedure. Its content varies between cases, but typically contains at
  11. * least the following elements:
  12. * - id: The message identifier.
  13. * - module: The module that handles the building of the message.
  14. * - key: The key of the message.
  15. * - to: The recipient email address.
  16. * - from: The email address of the sender.
  17. * - langcode: The langcode to use to compose the e-mail.
  18. * - params: The message parameters.
  19. *
  20. * This template may be overriden by module and/or mail key, using any of the
  21. * following template names:
  22. * - swiftmailer.html.twig: global, used by default.
  23. * - swiftmailer--mymodule.html.twig: only emails sent by the module "mymodule".
  24. * - swiftmailer--mymodule--test.html.twig: only emails by the module
  25. * "mymodule" with key "test".
  26. *
  27. * @see template_preprocess()
  28. * @see template_preprocess_swiftmailer()
  29. *
  30. * @ingroup themeable
  31. */
  32. #}
  33. <!doctype html>
  34. <html>
  35. <head>
  36. <meta name="viewport" content="width=device-width" />
  37. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  38. <title>{{ heading }}</title>
  39. <style>
  40. /* -------------------------------------
  41. GLOBAL RESETS
  42. ------------------------------------- */
  43. img {
  44. border: none;
  45. -ms-interpolation-mode: bicubic;
  46. max-width: 100%;
  47. }
  48. body {
  49. background-color: #f6f6f6;
  50. font-family: sans-serif;
  51. -webkit-font-smoothing: antialiased;
  52. font-size: 14px;
  53. line-height: 1.4;
  54. margin: 0;
  55. padding: 0;
  56. -ms-text-size-adjust: 100%;
  57. -webkit-text-size-adjust: 100%;
  58. direction: {{ dir }};
  59. }
  60. table {
  61. border-collapse: separate;
  62. mso-table-lspace: 0pt;
  63. mso-table-rspace: 0pt;
  64. width: 100%;
  65. direction: {{ dir }};
  66. }
  67. table td {
  68. font-family: sans-serif;
  69. font-size: 14px;
  70. vertical-align: top;
  71. }
  72. em {
  73. font-style: normal;
  74. font-weight: bold;
  75. }
  76. /* -------------------------------------
  77. BODY & CONTAINER
  78. ------------------------------------- */
  79. .body {
  80. background-color: #f6f6f6;
  81. width: 100%;
  82. }
  83. /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
  84. .container {
  85. display: block;
  86. margin: 0 auto !important;
  87. /* makes it centered */
  88. max-width: 580px;
  89. padding: 10px;
  90. width: 580px;
  91. }
  92. /* This should also be a block element, so that it will fill 100% of the .container */
  93. .content {
  94. box-sizing: border-box;
  95. display: block;
  96. margin: 0 auto;
  97. max-width: 580px;
  98. padding: 10px;
  99. }
  100. /* -------------------------------------
  101. HEADER, FOOTER, MAIN
  102. ------------------------------------- */
  103. .header {
  104. padding-top: 30px;
  105. padding-bottom: 30px;
  106. text-align: center;
  107. }
  108. .postheader {
  109. padding-bottom: 30px;
  110. text-align: center;
  111. font-size: 18px;
  112. }
  113. .main {
  114. background: #fff;
  115. border-radius: 3px;
  116. width: 100%;
  117. box-shadow: 0 -1px 0 #e0e0e0, 0 0 2px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.24);
  118. }
  119. .wrapper {
  120. box-sizing: border-box;
  121. padding: 50px;
  122. }
  123. .footer {
  124. clear: both;
  125. padding-top: 10px;
  126. text-align: center;
  127. width: 100%;
  128. }
  129. .footer td,
  130. .footer p,
  131. .footer span,
  132. .footer a {
  133. color: #999999;
  134. font-size: 12px;
  135. text-align: center;
  136. }
  137. .content-block {
  138. padding-top: 10px;
  139. }
  140. .content-block img {
  141. margin: 10px 0;
  142. }
  143. /* -------------------------------------
  144. TYPOGRAPHY
  145. ------------------------------------- */
  146. h1,
  147. h2,
  148. h3,
  149. h4 {
  150. color: #000000;
  151. font-family: sans-serif;
  152. font-weight: 400;
  153. line-height: 1.4;
  154. margin: 0;
  155. margin-bottom: 30px;
  156. }
  157. h1 {
  158. font-size: 35px;
  159. font-weight: 300;
  160. text-align: center;
  161. text-transform: capitalize;
  162. }
  163. p,
  164. ul,
  165. ol {
  166. font-family: sans-serif;
  167. font-size: 14px;
  168. font-weight: normal;
  169. margin: 0;
  170. margin-bottom: 15px;
  171. }
  172. p li,
  173. ul li,
  174. ol li {
  175. list-style-position: inside;
  176. margin-left: 5px;
  177. }
  178. ul {
  179. padding-left: 1em;
  180. }
  181. a {
  182. color: #328EC7;
  183. font-weight: bold;
  184. text-decoration: none;
  185. }
  186. a:hover, a:visited {
  187. text-decoration: underline;
  188. }
  189. /* -------------------------------------
  190. BUTTONS
  191. ------------------------------------- */
  192. .btn {
  193. box-sizing: border-box;
  194. width: 100%;
  195. }
  196. .btn > tbody > tr > td {
  197. padding-bottom: 15px;
  198. }
  199. .btn table {
  200. width: auto;
  201. }
  202. .btn table td {
  203. background-color: #ffffff;
  204. border-radius: 5px;
  205. text-align: center;
  206. }
  207. .btn a {
  208. background-color: #ffffff;
  209. border: solid 1px #784288;
  210. border-radius: 5px;
  211. box-sizing: border-box;
  212. color: #784288;
  213. cursor: pointer;
  214. display: inline-block;
  215. font-size: 14px;
  216. font-weight: bold;
  217. margin: 0;
  218. padding: 12px 25px;
  219. text-decoration: none;
  220. text-transform: capitalize;
  221. }
  222. .btn-primary table td {
  223. background-color: #784288;
  224. }
  225. .btn-primary a {
  226. background-color: #784288;
  227. border-color: #784288;
  228. color: #ffffff;
  229. }
  230. /* -------------------------------------
  231. OTHER STYLES THAT MIGHT BE USEFUL
  232. ------------------------------------- */
  233. .last {
  234. margin-bottom: 0;
  235. }
  236. .first {
  237. margin-top: 0;
  238. }
  239. .align-center {
  240. text-align: center;
  241. }
  242. .align-right {
  243. text-align: right;
  244. }
  245. .align-left {
  246. text-align: left;
  247. }
  248. .clear {
  249. clear: both;
  250. }
  251. .mt0 {
  252. margin-top: 0;
  253. }
  254. .mb0 {
  255. margin-bottom: 0;
  256. }
  257. .logo {
  258. max-height: 80px;
  259. max-width: 160px;
  260. }
  261. .preheader {
  262. color: transparent;
  263. display: none;
  264. height: 0;
  265. max-height: 0;
  266. max-width: 0;
  267. opacity: 0;
  268. overflow: hidden;
  269. mso-hide: all;
  270. visibility: hidden;
  271. width: 0;
  272. }
  273. .powered-by a {
  274. text-decoration: none;
  275. }
  276. hr {
  277. border: 0;
  278. border-bottom: 1px solid #f6f6f6;
  279. margin: 20px 0;
  280. }
  281. /* -------------------------------------
  282. RESPONSIVE AND MOBILE FRIENDLY STYLES
  283. ------------------------------------- */
  284. @media only screen and (max-width: 620px) {
  285. table[class=body] h1 {
  286. font-size: 28px !important;
  287. margin-bottom: 10px !important;
  288. }
  289. table[class=body] p,
  290. table[class=body] ul,
  291. table[class=body] ol,
  292. table[class=body] td,
  293. table[class=body] span,
  294. table[class=body] a {
  295. font-size: 16px !important;
  296. }
  297. table[class=body] .wrapper,
  298. table[class=body] .article {
  299. padding: 10px !important;
  300. }
  301. table[class=body] .content {
  302. padding: 0 !important;
  303. }
  304. table[class=body] .container {
  305. padding: 0 !important;
  306. width: 100% !important;
  307. }
  308. table[class=body] .main {
  309. border-left-width: 0 !important;
  310. border-radius: 0 !important;
  311. border-right-width: 0 !important;
  312. }
  313. table[class=body] .btn table {
  314. width: 100% !important;
  315. }
  316. table[class=body] .btn a {
  317. width: 100% !important;
  318. }
  319. table[class=body] .img-responsive {
  320. height: auto !important;
  321. max-width: 100% !important;
  322. width: auto !important;
  323. }
  324. }
  325. /* -------------------------------------
  326. PRESERVE THESE STYLES IN THE HEAD
  327. ------------------------------------- */
  328. @media all {
  329. .ExternalClass {
  330. width: 100%;
  331. }
  332. .ExternalClass,
  333. .ExternalClass p,
  334. .ExternalClass span,
  335. .ExternalClass font,
  336. .ExternalClass td,
  337. .ExternalClass div {
  338. line-height: 100%;
  339. }
  340. .apple-link a {
  341. color: inherit !important;
  342. font-family: inherit !important;
  343. font-size: inherit !important;
  344. font-weight: inherit !important;
  345. line-height: inherit !important;
  346. text-decoration: none !important;
  347. }
  348. .btn-primary table td:hover {
  349. background-color: #34495e !important;
  350. }
  351. .btn-primary a:hover {
  352. background-color: #34495e !important;
  353. border-color: #34495e !important;
  354. }
  355. }
  356. </style>
  357. </head>
  358. <body class="">
  359. <table border="0" cellpadding="0" cellspacing="0" class="body">
  360. <tr>
  361. <td>&nbsp;</td>
  362. <td class="container">
  363. <div class="content">
  364. <!-- START CENTERED WHITE CONTAINER -->
  365. <span class="preheader"></span>
  366. {% if logo %}
  367. <div class="header">
  368. <img src="{{ logo }}" alt="Logo" class="logo" />
  369. </div>
  370. {% endif %}
  371. <div class="postheader">
  372. {{ heading }}
  373. </div>
  374. <table class="main" style="background: #fff;border-radius: 3px;width: 100%;box-shadow: 0 -1px 0 #e0e0e0, 0 0 2px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.24);">
  375. <!-- START MAIN CONTENT AREA -->
  376. <tr>
  377. <td class="wrapper">
  378. <table border="0" cellpadding="0" cellspacing="0">
  379. <tr>
  380. <td>
  381. {{ body }}
  382. </td>
  383. </tr>
  384. </table>
  385. </td>
  386. </tr>
  387. <!-- END MAIN CONTENT AREA -->
  388. </table>
  389. <!-- START FOOTER -->
  390. <div class="footer">
  391. <table border="0" cellpadding="0" cellspacing="0">
  392. <tr>
  393. <td class="content-block">
  394. <strong class="brand">
  395. {% if site_link %}
  396. <a href="{{ base_url }}">{{ site_name }}</a>
  397. {% else %}
  398. {{ site_name }}
  399. {% endif %}
  400. </strong>
  401. {% if site_slogan %}
  402. <br />
  403. <span class="tagline">{{ site_slogan }}</span>
  404. {% endif %}
  405. </td>
  406. </tr>
  407. <tr>
  408. <td class="content-block powered-by">
  409. Copyright &copy;{{ "now"|date("Y") }}.
  410. </td>
  411. </tr>
  412. </table>
  413. </div>
  414. <!-- END FOOTER -->
  415. </div>
  416. </td>
  417. <td>&nbsp;</td>
  418. </tr>
  419. </table>
  420. </body>
  421. </html>