Class: Backup::Notifier::Mail
Instance Attribute Summary collapse
-
#address ⇒ Object
SMTP Server Address.
-
#authentication ⇒ Object
Authentication type.
-
#bcc ⇒ Object
BCC receiver Email Address.
-
#cc ⇒ Object
CC receiver Email Address.
-
#delivery_method ⇒ Object
Mail delivery method to be used by the Mail gem.
-
#domain ⇒ Object
Your domain (if applicable).
-
#encryption ⇒ Object
Set the method of encryption to be used for the
SMTP
connection. -
#exim_args ⇒ Object
Optional arguments to pass to ‘exim`.
-
#from ⇒ Object
Sender Email Address.
-
#mail_folder ⇒ Object
Folder where mail will be kept when using the ‘:file` `delivery_method`.
-
#openssl_verify_mode ⇒ Object
OpenSSL Verify Mode.
-
#password ⇒ Object
SMTP Server Password (sender email’s credentials).
-
#port ⇒ Object
SMTP Server Port.
-
#reply_to ⇒ Object
Set reply to email address.
-
#send_log_on ⇒ Object
Array of statuses for which the log file should be attached.
-
#sendmail_args ⇒ Object
Optional arguments to pass to ‘sendmail`.
-
#to ⇒ Object
Receiver Email Address.
-
#user_name ⇒ Object
SMTP Server Username (sender email’s credentials).
Attributes inherited from Base
#max_retries, #message, #model, #on_failure, #on_success, #on_warning, #retry_waitsec
Instance Method Summary collapse
-
#initialize(model, &block) ⇒ Mail
constructor
A new instance of Mail.
Methods inherited from Base
Methods included from Config::Helpers
Methods included from Utilities::Helpers
Constructor Details
#initialize(model, &block) ⇒ Mail
Returns a new instance of Mail.
133 134 135 136 137 138 139 |
# File 'lib/backup/notifier/mail.rb', line 133 def initialize(model, &block) super instance_eval(&block) if block_given? @send_log_on ||= [:warning, :failure] @encryption ||= :starttls end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backup::Config::Helpers
Instance Attribute Details
#address ⇒ Object
SMTP Server Address
54 55 56 |
# File 'lib/backup/notifier/mail.rb', line 54 def address @address end |
#authentication ⇒ Object
Authentication type
Acceptable values: :plain
, :login
, :cram_md5
76 77 78 |
# File 'lib/backup/notifier/mail.rb', line 76 def authentication @authentication end |
#bcc ⇒ Object
BCC receiver Email Address
46 47 48 |
# File 'lib/backup/notifier/mail.rb', line 46 def bcc @bcc end |
#cc ⇒ Object
CC receiver Email Address
42 43 44 |
# File 'lib/backup/notifier/mail.rb', line 42 def cc @cc end |
#delivery_method ⇒ Object
Mail delivery method to be used by the Mail gem.
Supported methods:
- :smtp - ::Mail::SMTP (default)
-
Settings used by this method: #address, #port, #domain, #user_name, #password, #authentication, #encryption, #openssl_verify_mode
- :sendmail - ::Mail::Sendmail
-
Settings used by this method: #sendmail_args
- :exim - ::Mail::Exim
-
Settings used by this method: #exim_args
- :file - ::Mail::FileDelivery
-
Settings used by this method: #mail_folder
30 31 32 |
# File 'lib/backup/notifier/mail.rb', line 30 def delivery_method @delivery_method end |
#domain ⇒ Object
Your domain (if applicable)
62 63 64 |
# File 'lib/backup/notifier/mail.rb', line 62 def domain @domain end |
#encryption ⇒ Object
Set the method of encryption to be used for the SMTP
connection.
- :starttls (default)
-
Use
STARTTLS
to upgrade the connection to aSSL/TLS
connection. - :tls or :ssl
-
Use a
SSL/TLS
connection. - :none
-
No encryption will be used.
89 90 91 |
# File 'lib/backup/notifier/mail.rb', line 89 def encryption @encryption end |
#exim_args ⇒ Object
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’
118 119 120 |
# File 'lib/backup/notifier/mail.rb', line 118 def exim_args @exim_args end |
#from ⇒ Object
Sender Email Address
34 35 36 |
# File 'lib/backup/notifier/mail.rb', line 34 def from @from end |
#mail_folder ⇒ Object
Folder where mail will be kept when using the ‘:file` `delivery_method`.
Default location is ‘$HOME/Backup/emails’
124 125 126 |
# File 'lib/backup/notifier/mail.rb', line 124 def mail_folder @mail_folder end |
#openssl_verify_mode ⇒ Object
OpenSSL Verify Mode
Valid modes: :none
, :peer
, :client_once
, :fail_if_no_peer_cert
See OpenSSL::SSL
for details.
Use :none
for a self-signed and/or wildcard certificate
98 99 100 |
# File 'lib/backup/notifier/mail.rb', line 98 def openssl_verify_mode @openssl_verify_mode end |
#password ⇒ Object
SMTP Server Password (sender email’s credentials)
70 71 72 |
# File 'lib/backup/notifier/mail.rb', line 70 def password @password end |
#port ⇒ Object
SMTP Server Port
58 59 60 |
# File 'lib/backup/notifier/mail.rb', line 58 def port @port end |
#reply_to ⇒ Object
Set reply to email address
50 51 52 |
# File 'lib/backup/notifier/mail.rb', line 50 def reply_to @reply_to end |
#send_log_on ⇒ Object
Array of statuses for which the log file should be attached.
Available statuses are: ‘:success`, `:warning` and `:failure`. Default: [:warning, :failure]
131 132 133 |
# File 'lib/backup/notifier/mail.rb', line 131 def send_log_on @send_log_on end |
#sendmail_args ⇒ Object
Optional arguments to pass to ‘sendmail`
Note that this will override the defaults set by the Mail gem (currently: ‘-i’). So, if set here, be sure to set all the arguments you require.
Example: ‘-i -X/tmp/traffic.log’
108 109 110 |
# File 'lib/backup/notifier/mail.rb', line 108 def sendmail_args @sendmail_args end |
#to ⇒ Object
Receiver Email Address
38 39 40 |
# File 'lib/backup/notifier/mail.rb', line 38 def to @to end |
#user_name ⇒ Object
SMTP Server Username (sender email’s credentials)
66 67 68 |
# File 'lib/backup/notifier/mail.rb', line 66 def user_name @user_name end |