Commit Graph

18 Commits

Author SHA1 Message Date
Aaron Patterson
397693a5ea
Merge pull request #26445 from dracos/multiparty
Correctly wrap inline attachments.
2020-08-19 10:10:36 -07:00
John Hawthorn
4e6c8045c3 Add test and change how format set in ActionMailer
Previously this used self.formats= to set the format which render would
use to find templates. This worked, but was untested, and looked a
little confusing because it was doing the mutation within a loop.

This commit replaces the assignment with passing formats: [format] into
the render call, which makes it more obvious that that's the purpose of
the format. It also adds a test to verify the formats being used.
2019-03-01 14:07:59 -08:00
Matthew Somerville
c95e98090b Correctly wrap inline attachments.
This switches the behaviour from:

multipart/related
  multipart/alternative
    text/plain
    text/html
  attachment (disposition: inline, image1)
  attachment (disposition: attachment, file1)
  attachment (disposition: attachment, file2)

to:

multipart/mixed
  multipart/related
    multipart/alternative
      text/plain
      text/html
    attachment (disposition: inline, image1)
  attachment (disposition: attachment, file1)
  attachment (disposition: attachment, file2)

Fixes #2686.

Thanks to clemens and eGust for reviewing.
2019-01-22 09:50:10 +00:00
Thiago Pradi
bc970e8335 Removing unused mailer templates 2015-03-01 16:07:24 -03:00
Rafael Mendonça França
ecb1981bfd Template lookup now respect default locale and I18n fallbacks.
Given the following templates:

    mailer/demo.html.erb
    mailer/demo.en.html.erb
    mailer/demo.pt.html.erb

Before this change for a locale that doesn't have its related file
the `mailer/demo.html.erb` will
be rendered even if `en` is the default locale.

Now `mailer/demo.en.html.erb` has precedence over the file without
 locale.

Also, it is possible to give a fallback.

    mailer/demo.pt.html.erb
    mailer/demo.pt-BR.html.erb

So if the locale is `pt-PT`, `mailer/demo.pt.html.erb` will be
 rendered given the right I18n fallback configuration.

Fixes #11884.
2014-12-29 23:48:35 -03:00
Mr A
3134605391 Ruby's new Hash syntax applied in actionmailer 2013-11-14 13:41:37 +05:30
Yves Senn
b786f065d3 Do not render views when mail() isn't called. (NullMail refactoring) 2012-10-28 20:45:43 +01:00
Damien Mathieu
45b1045d16 raise an error if no implicit mailer template could be found 2012-06-20 22:06:31 +02:00
José Valim
84cab320bc Ensure templates like template.html are found but still uses the proper virtual path. 2010-08-26 16:07:54 -03:00
Mikel Lindsaar
311d99eef0 Adding inline attachment support to ActionMailer 2010-06-07 21:54:53 -04:00
José Valim
f28d856cec Improve performance of the rendering stack by freezing formats as a sign that they shouldn't be further modified. 2010-03-19 17:20:20 +01:00
Mikel Lindsaar
2960077445 Add a failing test case for render :layout
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-29 17:51:05 +01:00
Mikel Lindsaar
b6b3db6734 Fixed bug on HTML only emails getting set to text/plain 2010-01-28 00:24:30 +11:00
José Valim and Mikel Lindsaar
0ece244fee Ensure implicit multipart templates with locale works as expected. 2010-01-24 23:59:12 +01:00
José Valim and Mikel Lindsaar
c985a0ee3d Add some tests to collector with templates and any. 2010-01-23 12:46:40 +01:00
José Valim and Mikel Lindsaar
951397b4a2 Get implicit multipart and attachments working together. 2010-01-22 14:38:41 +01:00
José Valim and Mikel Lindsaar
1cd55928c6 First work on implicit multipart. 2010-01-22 13:56:06 +01:00
José Valim and Mikel Lindsaar
dcb9253693 Add basic template rendering to new DSL. 2010-01-22 13:27:26 +01:00