21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-28 06:50:49 +02:00
chexpire/app/mailers/notifications_mailer.rb
2018-07-02 18:40:09 +02:00

35 lines
875 B
Ruby

class NotificationsMailer < ApplicationMailer
helper :application
before_action do
@notification = params.fetch(:notification)
@check = @notification.check
end
default to: -> { @notification.recipient }
def domain_expires_soon
@expire_in_days = Integer(@check.domain_expires_at.to_date - Date.today)
subject = t(".subject", domain: @check.domain, count: @expire_in_days)
mail subject: subject
end
def domain_recurrent_failures
subject = t(".subject", domain: @check.domain)
mail subject: subject
end
def ssl_expires_soon
@expire_in_days = Integer(@check.domain_expires_at.to_date - Date.today)
subject = t(".subject", domain: @check.domain, count: @expire_in_days)
mail subject: subject
end
def ssl_recurrent_failures
subject = t(".subject", domain: @check.domain)
mail subject: subject
end
end