Sha256: efe5422ad2b9080ebd904f791910f9810794d210f8fed49710630d5c3c4aec6b
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'pony' module LetsencryptWebfaction class Emailer SUBJECT_MESSAGE = 'New certificate installation'.freeze def initialize(instructions, support_email: '', account_email: '', notification_email: '') @instructions = instructions raise Error, 'Missing account_email' if account_email == '' || account_email.nil? raise Error, 'Missing notification_email' if notification_email == '' || notification_email.nil? @support_email = support_email @account_email = account_email @notification_email = notification_email end def send! send_to_support! send_to_account! end def send_to_support! return if @support_email.nil? || @support_email == '' Pony.mail(to: @support_email, from: @account_email, subject: SUBJECT_MESSAGE, body: @instructions.instructions) end def send_to_account! Pony.mail(to: @notification_email, from: @notification_email, subject: SUBJECT_MESSAGE, body: @instructions.full_message(support_email: @support_email != '')) end class Error < StandardError; end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
letsencrypt_webfaction-1.0.1 | lib/letsencrypt_webfaction/emailer.rb |
letsencrypt_webfaction-1.0.0 | lib/letsencrypt_webfaction/emailer.rb |