html_email_style.rb 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Rails.application.config.html_email_css_font = "font-family:'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif; font-size: 12px;"
  2. Rails.application.config.html_email_body = <<~HERE
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  8. <style type="text/css">
  9. body {
  10. #{Rails.application.config.html_email_css_font};
  11. }
  12. img {
  13. outline: none;
  14. text-decoration: none;
  15. -ms-interpolation-mode: bicubic;
  16. }
  17. a img {
  18. border: none;
  19. }
  20. table td {
  21. border-collapse: collapse;
  22. }
  23. table {
  24. border-collapse: collapse;
  25. mso-table-lspace: 0pt;
  26. mso-table-rspace: 0pt;
  27. border: none;
  28. table-layout: auto;
  29. display: block;
  30. width: 100%;
  31. overflow: auto;
  32. word-break: keep-all;
  33. }
  34. table,
  35. pre,
  36. blockquote {
  37. margin: 0 0 16px;
  38. }
  39. td, th {
  40. padding: 7px 12px;
  41. border: 1px solid hsl(0,0%,87%);
  42. }
  43. th {
  44. font-weight: bold;
  45. text-align: center;
  46. }
  47. tbody tr:nth-child(even) {
  48. background: hsl(0,0%,97%);
  49. }
  50. col {
  51. width: auto;
  52. }
  53. p {
  54. margin: 0;
  55. }
  56. code {
  57. border: none;
  58. background: hsl(0,0%,97%);
  59. white-space: pre-wrap;
  60. }
  61. blockquote {
  62. padding: 8px 12px;
  63. border-left: 5px solid #eee;
  64. }
  65. pre {
  66. padding: 12px 15px;
  67. font-size: 13px;
  68. line-height: 1.45;
  69. background: hsl(0,0%,97%);
  70. white-space: pre-wrap;
  71. border-radius: 3px;
  72. border: none;
  73. overflow: auto;
  74. }
  75. </style>
  76. </head>
  77. <body style="#{Rails.application.config.html_email_css_font}">###html###</body>
  78. </html>
  79. HERE