Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space TDDM and version 1

Getting set up

On new installs, Totara uses the default PHP method of sending mail. 

You can define an SMTP server (as well as other email configuration) on the Outgoing mail configuration page which can be found via the Admin menu > Server > Email.

For site setup and development there are a number of options available to ensure that emails are sent correctly and to allow the content of sent emails to be checked. Importantly these options can also ensure that emails are not sent inadvertently.

Here are some of the options.

Config setting ‘noemailever’

Code Block
$CFG->noemailever = true;

This setting disables the sending of emails at the point of the emails being sent. This is useful when testing production data in a test environment.

This setting should never be used for production sites.

Config setting ‘divertallemailsto’

Code Block
$CFG->divertallemailsto = 'developer@example.com';

This will force Totara to divert all email to the specified address. You can use this in conjunction with divertallemailsexceptwhich is a comma-separated list of email addresses or regular expressions that you want to exclude from the diversion.

Code Block
$CFG->divertallemailsexcept = 'tester@example.com, developer(\+.*)?@example.com';

Mailcatcher

Mailcatcher catches all sent mail and stores it for display within a web browser.

The smtphosts setting will need to be set accordingly, e.g.:

Code Block
$CFG->smtphosts = ‘localhost:1025’;

Further information can be found at https://mailcatcher.me.

Maildev

Maildev is alternative to mailcatcher solution and is easy to get started.

Install maildev via npm:

Code Block
languagebash
npm install -g maildev


Open new terminal tab and start maildev:

Code Block
languagebash
maildev


Configure your Totara instance to use maildev:

Code Block
languagephp
titleconfig.php
$CFG->smtphosts = ‘localhost:1025’;


Open maildev web interface in browser :

Code Block
http://localhost:1080/