html_email_style.rb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. <style type="text/css">
  8. body {
  9. width: 90% !important;
  10. -webkit-text-size-adjust: 90%;
  11. -ms-text-size-adjust: 90%;
  12. #{Rails.application.config.html_email_css_font};
  13. }
  14. img {
  15. outline: none;
  16. text-decoration: none;
  17. -ms-interpolation-mode: bicubic;
  18. }
  19. a img {
  20. border: none;
  21. }
  22. table td {
  23. border-collapse: collapse;
  24. }
  25. table {
  26. border-collapse: collapse;
  27. mso-table-lspace: 0pt;
  28. mso-table-rspace: 0pt;
  29. border: none;
  30. table-layout: auto;
  31. display: block;
  32. width: 100%;
  33. overflow: auto;
  34. word-break: keep-all;
  35. }
  36. p, table, div, td {
  37. max-width: 600px;
  38. }
  39. table,
  40. pre,
  41. blockquote {
  42. margin: 0 0 16px;
  43. }
  44. td, th {
  45. padding: 7px 12px;
  46. border: 1px solid hsl(0,0%,87%);
  47. }
  48. th {
  49. font-weight: bold;
  50. text-align: center;
  51. }
  52. tbody tr:nth-child(even) {
  53. background: hsl(0,0%,97%);
  54. }
  55. col {
  56. width: auto;
  57. }
  58. p {
  59. margin: 0;
  60. }
  61. code {
  62. border: none;
  63. background: hsl(0,0%,97%);
  64. white-space: pre-wrap;
  65. }
  66. blockquote {
  67. padding: 8px 12px;
  68. border-left: 5px solid #eee;
  69. }
  70. pre {
  71. padding: 12px 15px;
  72. font-size: 13px;
  73. line-height: 1.45;
  74. background: hsl(0,0%,97%);
  75. white-space: pre-wrap;
  76. border-radius: 3px;
  77. border: none;
  78. overflow: auto;
  79. }
  80. </style>
  81. <head>
  82. <body style="#{Rails.application.config.html_email_css_font}">###html###</body>
  83. </html>
  84. HERE