Class: Feedbook::Notifiers::MailNotifier
- Inherits:
-
Object
- Object
- Feedbook::Notifiers::MailNotifier
- Includes:
- Singleton
- Defined in:
- lib/feedbook/notifiers/mail_notifier.rb
Instance Method Summary collapse
-
#load_configuration(configuration = {}) ⇒ NilClass
Load configuration for MailNotifier.
-
#notify(message) ⇒ NilClass
Sends notification to Mail.
Instance Method Details
#load_configuration(configuration = {}) ⇒ NilClass
Load configuration for MailNotifier
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/feedbook/notifiers/mail_notifier.rb', line 28 def load_configuration(configuration = {}) = { address: configuration.fetch('address'), port: configuration.fetch('port', 5870), domain: configuration.fetch('domain'), user_name: configuration.fetch('username'), password: configuration.fetch('password'), authentication: configuration.fetch('authentication', 'plain'), enable_starttls_auto: configuration.fetch('enable_starttls_auto', true) } @to = configuration.fetch('to') @from = configuration.fetch('from') @subject = configuration.fetch('subject') Mail.defaults do delivery_method :smtp, end puts 'Configuration loaded for MailNotifier' end |
#notify(message) ⇒ NilClass
Sends notification to Mail
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/feedbook/notifiers/mail_notifier.rb', line 13 def notify() Mail.deliver do to to from from subject subject body end puts "New message has been notified on Mail: #{}" end |