Email

Send backup reports as email

The email notifier allows you to receive a report on success or failure of each of your backup jobs. It uses the Mail library thus supports several delivery methods (namely SMTP, sendmail and exim) to deliver the backup reports.

Common options

Option

Description

from

The sender's email address

Required: yes

to

The recipient's email address

Required: yes

using

The delivery method, see below

Required: yes

with

The delivery settings, see below

Required: no

You'll likely want to Specify default values globally for email notifications.

SMTP

Sending through a local STMP server does not require any specific setup. You only have to provide the sender's and recipient's addresses.

job "my-project" do
  ...
  notify via: 'email',
  	from: "[email protected]",
  	to: "[email protected]",
  	using: "smtp"
end

SMTP delivery settings

SMTP settings can be specified by providing to the with option an hash of settings:

job "my-project" do
  ...
  notify via: 'email',
  	from: "[email protected]",
  	to: "[email protected]",
  	using: "smtp",
  	with: {
      address: "smtp.example.com",
      user_name: "user",
      password: "secret"
    }
end

Setting

Description

address

The hostname or IP address of the SMTP server

Defaults to: localhost

port

The port number the SMTP server listens to.

Defaults to: 25

domain

The HELO domain (the host to send the message from).

Defaults to: localhost.localdomain

user_name

The username to use for authentication

password

The password to use for authentication

authentication

The authentication method

One of: plain, login or cram_md5

enable_starttls_auto

Indicates whether the notifier should create an initial connection to the SMTP server, then upgrade it to enable encryption

Defaults to: true

ssl

Indicates whether the notifier should directly try to connect using an SSL connection

Defaults to: false

tls

Indicates whether the notifier should directly try to connect using a TLS connection

Defaults to: false

Common configurations

job "my-project" do
  ...
  notify via: "email",
    from: "[email protected]",
    to: "[email protected]",
    using: "smtp", with: {
      address: "smtp.gmail.com",
      domain: "your.hostname.com",
      port: 587,
      user_name: "gmail-username",
      password: "gmail-password",
      authentication: "plain",
      enable_starttls_auto: true
    }
end
project "my-project" do
  ...
  notify via: "email",
    from: "[email protected]",
    to: "[email protected]",
    using: "smtp", with: {
      address: "smtp.sendgrid.net",
      domain: "your.hostname.com",
      port: 25, # 587 and 2525 also supported with STARTTLS
      user_name: "sendgrid-username",
      password: "sendgrid-password",
      authentication: "plain",
      enable_starttls_auto: true
    }
end
project "my-project" do
  ...
  notify via: "email",
    from: "[email protected]",
    to: "[email protected]",
    using: "smtp", with: {
      address: "smtp.mandrillapp.com",
      domain: "your.hostname.com",
      port: 25, # 587 and 2525 also supported with STARTTLS
      user_name: "mandrill-username",
      password: "mandrill-password",
      authentication: "login",
      enable_starttls_auto: true
    }
end

Sendmail

This delivery method requires the sendmail binary to be present. It usually resides in /usr/sbin/sendmail and is provided by the Sendmail or Postfix packages. A lightweight alternative is SSMTP which redirects calls to sendmail to an external SMTP server.

The notifier assumes the Sendmail program is properly configured.

Option

Description

location

The absolute path to the sendmail program

Required: no

project "my-project" do
  ...
  notify via: "email",
    from: "[email protected]",
    to: "[email protected]",
  	using: "sendmail", with: {
      # Optional, the default location usually does the job
      location: "/path/to/sendmail"
    }
end

Exim

This delivery method requires the exim binary to be present. It usually resides in /usr/sbin/exim and is provided by the Exim4 package.

The notifier assumes the Exim program is properly configured.

Option

Description

location

The absolute path to the exim program

Required: no

project "my-project" do
  ...
  notify via: "email",
    from: "[email protected]",
    to: "[email protected]",
    using: "exim", with: {
      # Optional, the default location usually does the job
      location: "/path/to/exim"
    }
end