I’m sending an email that includes an image. At the time the message is processed, the image may not be in place yet. The ActionMailer docs mention using an after_action
method to set mail.perform_deliveries = false
. However, performing this check isn’t necessary for any other message sent by this OrderMailer.
Ideally, in this particular mailer method, I could check if the image exists yet, and if not, set mail.perform_deliveries = false
, re-queue the message to try again in a couple minutes, and return nil (why build a message body that won’t be used?).
Anyone know if this is possible directly in the mailer method? Or will I have to use an after_action
method? I guess if the after_action
method is necessary, it could be restricted to the particular mailer method that needs it similar to controller filters?