Class: Backup::Notifier::Mail

Inherits:
Base
  • Object
show all
Defined in:
lib/backup/notifier/mail.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#on_failure, #on_success, #on_warning

Instance Method Summary collapse

Methods inherited from Base

#perform!

Methods included from Configuration::Helpers

included

Constructor Details

#initialize(model, &block) ⇒ Mail

Returns a new instance of Mail.



110
111
112
113
114
# File 'lib/backup/notifier/mail.rb', line 110

def initialize(model, &block)
  super(model)

  instance_eval(&block) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers

Instance Attribute Details

#addressObject

The address to use Example: smtp.gmail.com



44
45
46
# File 'lib/backup/notifier/mail.rb', line 44

def address
  @address
end

#authenticationObject

Authentication type Example: plain



66
67
68
# File 'lib/backup/notifier/mail.rb', line 66

def authentication
  @authentication
end

#delivery_methodObject

Mail delivery method to be used by the Mail gem. Supported methods:

‘:smtp` [::Mail::SMTP] (default) : Settings used only by this method: : `address`, `port`, `domain`, `user_name`, `password` : `authentication`, `enable_starttls_auto`, `openssl_verify_mode`

‘:sendmail` [::Mail::Sendmail] : Settings used only by this method: : `sendmail`, `sendmail_args`

‘:exim` [::Mail::Exim] : Settings used only by this method: : `exim`, `exim_args`

‘:file` [::Mail::FileDelivery] : Settings used only by this method: : `mail_folder`



32
33
34
# File 'lib/backup/notifier/mail.rb', line 32

def delivery_method
  @delivery_method
end

#domainObject

Your domain (if applicable) Example: mydomain.com



54
55
56
# File 'lib/backup/notifier/mail.rb', line 54

def domain
  @domain
end

#enable_starttls_autoObject

Automatically set TLS Example: true



71
72
73
# File 'lib/backup/notifier/mail.rb', line 71

def enable_starttls_auto
  @enable_starttls_auto
end

#eximObject

When using the ‘:exim` `delivery_method` option, this may be used to specify the absolute path to `exim` (if needed) Example: ’/usr/sbin/exim’



95
96
97
# File 'lib/backup/notifier/mail.rb', line 95

def exim
  @exim
end

#exim_argsObject

Optional arguments to pass to ‘exim` Note that this will override the defaults set by the Mail gem (currently: ’-i -t’) So, if set here, be sure to set all the arguments you require. Example: ‘-i -t -X/tmp/traffic.log’



102
103
104
# File 'lib/backup/notifier/mail.rb', line 102

def exim_args
  @exim_args
end

#fromObject

Sender and Receiver email addresses Examples:

sender   - [email protected]
receiver - [email protected]


39
40
41
# File 'lib/backup/notifier/mail.rb', line 39

def from
  @from
end

#mail_folderObject

Folder where mail will be kept when using the ‘:file` `delivery_method` option. Default location is ’$HOME/Backup/emails’ Example: ‘/tmp/test-mails’



108
109
110
# File 'lib/backup/notifier/mail.rb', line 108

def mail_folder
  @mail_folder
end

#openssl_verify_modeObject

OpenSSL Verify Mode Example: none - Only use this option for a self-signed and/or wildcard certificate



76
77
78
# File 'lib/backup/notifier/mail.rb', line 76

def openssl_verify_mode
  @openssl_verify_mode
end

#passwordObject

Username and Password (sender email’s credentials) Examples:

user_name - meskyanichi
password  - my_secret_password


61
62
63
# File 'lib/backup/notifier/mail.rb', line 61

def password
  @password
end

#portObject

The port to connect to Example: 587



49
50
51
# File 'lib/backup/notifier/mail.rb', line 49

def port
  @port
end

#sendmailObject

When using the ‘:sendmail` `delivery_method` option, this may be used to specify the absolute path to `sendmail` (if needed) Example: ’/usr/sbin/sendmail’



82
83
84
# File 'lib/backup/notifier/mail.rb', line 82

def sendmail
  @sendmail
end

#sendmail_argsObject

Optional arguments to pass to ‘sendmail` Note that this will override the defaults set by the Mail gem (currently: ’-i -t’) So, if set here, be sure to set all the arguments you require. Example: ‘-i -t -X/tmp/traffic.log’



89
90
91
# File 'lib/backup/notifier/mail.rb', line 89

def sendmail_args
  @sendmail_args
end

#toObject

Sender and Receiver email addresses Examples:

sender   - [email protected]
receiver - [email protected]


39
40
41
# File 'lib/backup/notifier/mail.rb', line 39

def to
  @to
end

#user_nameObject

Username and Password (sender email’s credentials) Examples:

user_name - meskyanichi
password  - my_secret_password


61
62
63
# File 'lib/backup/notifier/mail.rb', line 61

def user_name
  @user_name
end