Configure the mail server

To configure the mail server you'll need to:

  1. Grab a copy of the /opt/dradispro/dradispro/current/config/smtp.yml.template file and copy it to /opt/dradispro/dradispro/shared/config/ as smtp.yml (remove ".template").

    To do this, you can run the following command as dradispro:

    cp /opt/dradispro/dradispro/current/config/smtp.yml.template /opt/dradispro/dradispro/shared/config/smtp.yml
  2. Edit the contents of the new file. The file itself will walk you through how to configure the mail server.

  3. Add a symlink to the file in the config directory by running the following in the command line as dradispro:

    ln -s /opt/dradispro/dradispro/shared/config/smtp.yml /opt/dradispro/dradispro/current/config/
  4. Now re-apply the latest DUP.

Now, your Dradis instance should be ready to send out password reset emails or email digests. Since this change is not a local change, it will survive future upgrades!

A note about using Gmail

A sample for using your personal gmail account as smtp server:

default: &default
  default_url_options:
    host:         dradisframework.dev
    script_name:  ''
  default_options:
    from:     from@dradisframework.dev
    reply_to: reply@dradisframework.dev
  smtp_settings:
    address:               smtp.gmail.com
    port:                  587
    domain:                dradisframework.com
    user_name:             example@gmail.com
    password:              insecure!!
    authentication:        plain
    enable_starttls_auto:  true
    openssl_verify_mode:   none

A sample for using an account in your Gsuite with custom domain as smtp server:

default: &default
  default_url_options:
    host:         dradisframework.dev
    script_name:  ''
  default_options:
    from:     from@dradisframework.dev
    reply_to: reply@dradisframework.dev
  smtp_settings:
    address:               smtp.gmail.com
    port:                  587
    domain:                example.com
    user_name:             example@example.com
    password:              gsuite gmail account password
    authentication:        plain
    enable_starttls_auto:  true
    openssl_verify_mode:   none

As of July 15, 2014, Google increased its security measures and now blocks attempts from apps it deems less secure. You can change your Gmail settings here to allow the attempts. If your Gmail account has 2-factor authentication enabled, then you will need to set an app password and use that instead of your regular password.
(source: https://guides.rubyonrails.org/action_mailer_basics.html)

Also note that when trying to use a Gsuite account with a custom domain with 2FA enabled and an app password, we still needed to choose the option Allow users to manage their acccess to less secure apps in the gsuite admin panel, under Security > Basic Settings > Less secure apps: Customization 19 Even with Less secure apps turned off for the account sending the mails, without that option selected emails may not be sent, and you may keep seeing this error:

Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.)