Commit Graph

40 Commits

Author SHA1 Message Date
Sunny Ripert
3a8dbe1746 Escape email addresses with name 2019-08-26 17:21:06 +02:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09: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
Jaap van der Plas
2488901da8 Don’t log recipients when sending mail
Since production applications typically run with log level info and
email adresses should be considered as sensitive data we want to prevent 
them from ending up in the logs. In development mode (with log level
debug) they are still logged as part of the Mail::Message object.
2019-02-13 09:55:38 -05:00
Rafael Mendonça França
72062c8c9d Merge pull request #22534 from evopark/master
ActionMailer: support overriding template name in multipart
2018-11-19 19:23:44 -05:00
Yoshiyuki Kinjo
383b8bc8e2 Skip delivery notification when perform_deliveries is false. 2018-09-08 17:29:28 +09:00
Jimmy Bourassa
fbb2fc8aa7 Fix AM::Base.default proc arity breaking change
PR #29270 changed the number of arguments that gets passed to Procs
defined in ActionMail::Base.default. With this changeset, Procs can
now have 1 or 0 arguments

Also adds test coverage for AM::Base.default Proc arity.
2017-08-29 09:42:28 -04:00
Kir Shatrov
82df8c2ca5 Use frozen string literal in actionmailer/ 2017-07-23 18:17:19 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
David Heinemeier Hansson
1cec84ad2d Offer the option to use parameterization for shared processing of headers and ivars (#27825)
Offer the option to use parameterization for shared processing of headers and ivars
2017-01-28 11:20:46 +01:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Rafael Mendonça França
79a5ea9ead
Remove deprecated support to :text in render 2016-10-10 00:02:52 -03:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
b91ff557ef applies new string literal convention in actionmailer/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:03:39 +02:00
Jeremy Daer
e35b98e6f5
Action Mailer: Declarative exception handling with rescue_from.
Follows the same pattern as controllers and jobs. Exceptions raised in
delivery jobs (enqueued by `#deliver_later`) are also delegated to the
mailer's rescue_from handlers, so you can handle the DeserializationError
raised by delivery jobs:

```ruby
class MyMailer < ApplicationMailer
  rescue_from ActiveJob::DeserializationError do
    …
  end
```

ActiveSupport::Rescuable polish:
* Add the `rescue_with_handler` class method so exceptions may be
  handled at the class level without requiring an instance.
* Rationalize `exception.cause` handling. If no handler matches the
  exception, fall back to the handler that matches its cause.
* Handle exceptions raised elsewhere. Pass `object: …` to execute
  the `rescue_from` handler (e.g. a method call or a block to
  instance_exec) against a different object. Defaults to `self`.
2016-05-15 18:44:16 -07:00
Vipul A M
cbb25c4b1c Expand on Action Mailer Fragment caching tests 2016-04-17 23:16:09 +05:30
Stan Lo
049b6e670f Porting ActionController::Caching to ActionMailer::Caching 2016-02-23 21:04:16 -03:00
Marcus Ilgner
5c54db290f
ActionMailer: support overriding template name in multipart
Implicit rendering in multipart blocks now also uses the template
name from the options hash instead of always using the action name.

So you can now write

    mail(template_name: template_name) do |format|
      format.text
      format.html
    end
2015-12-08 15:50:43 +01:00
Ronak Jangir
fef6c11d2a Added test for any if called without specifying any format
Example
````ruby
mail(hash) do |format|
  format.any
end
````
2015-09-18 22:56:42 +05:30
Abdelkader Boudih
67f8b6b2bc Added ActionMailer::DeliverLater 2014-08-13 11:36:32 +00:00
Mr A
3134605391 Ruby's new Hash syntax applied in actionmailer 2013-11-14 13:41:37 +05:30
Alex Tsukernik
49185875a5 don't convert mailer default values to procs
Invoke mailer defaults as procs only if they are procs, do not convert
with to_proc.  That an object is convertible to a proc does not mean it's
meant to be always used as a proc.  Fixes #11533
2013-07-22 14:25:20 -04:00
kennyj
98849c71ac Fix AM testcase break with mail 2.5.4. It seems that AM's testcase was wrong. 2013-05-17 09:44:01 +09:00
Vipul A M
6893c23f48 drop an unused hash; change slang to SPECIAL 2013-03-19 11:00:01 +05:30
Olek Janiszewski
57bfbc249e Allow passing interpolations to #default_i18n_subject, e.g.:
# config/locales/en.yml
    en:
      user_mailer:
        welcome:
          subject: 'Hello, %{username}'

    # app/mailers/user_mailer.rb
    class UserMailer < ActionMailer::Base
      def welcome(user)
        mail(subject: default_i18n_subject(username: user.name))
      end
    end
2013-01-24 15:29:24 +01:00
Jeremy Kemper
f9da785d0b Move background jobs to the 'jobs' branch until fully baked. Not shipping with Rails 4.0. 2012-12-21 16:29:47 -08:00
Yves Senn
ec3429a3d6 The return value from mailer methods is not relevant. 2012-12-10 09:10:47 +01:00
Yves Senn
b786f065d3 Do not render views when mail() isn't called. (NullMail refactoring) 2012-10-28 20:45:43 +01:00
Kirill Nikitin
96f290eac0 Update actionmailer with new hash syntax. 2012-10-07 21:54:14 +04:00
Jeremy Kemper
2a301505ec Use synchronous queue by default. Separate queued message delivery jobs from the queued message wrappers so the queue itself needn't be marshaled (due to queue reference QueuedMessage). 2012-09-16 22:37:47 -07:00
Santiago Pastorino
34b23e7110 Action Mailer async flag is true by default using a Synchronous impl 2012-09-11 15:11:52 -07:00
Brian Cardarella
dc7fd821dc Asynchronous ActionMailer
Any ActionMailer class can be set to render and delier messages using
the new Rails Queue.

Some of this work was borrowed (with permission) from Nick Plante's
(zapnap) reqsue_mailer gem.
2012-06-23 14:36:09 -04:00
José Valim
119e9e2daf Get rid of update_details in favor of passing details to find_template. 2011-09-22 15:03:05 +02:00
José Valim
972efa11fd Deprecate the old mailer API that was not deprecated yet. 2010-08-29 20:42:13 -03: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
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Jeroen van Dijk and Josh Kalderimis
affeb51569 Move config_accessor :asset_host from ActionController::Base to AbstractController which fixes issues with asset_host in ActionMailer
Including:
  - Moved mailer objects in separate directory
  - Added two tests for asset_host configuration option
2010-07-24 00:27:25 +02:00