Back to Openproject

Configuring outbound emails

docs/installation-and-operations/configuration/outbound-emails/README.md

17.3.17.7 KB
Original Source

Configuring outbound emails

SMTP

In this guide we will describe how to configure outbound emails using an external SMTP server.

Requirements

You will need to have SMTP settings ready. Those can either be from a company SMTP server, a Gmail account, or a public provider such as SendGrid.

Taking SendGrid as an example, you would need to sign up on their website (they offer a free plan with up to 12000 emails per month), and once your account is provisioned, generate a new API key and copy it somewhere (it looks like 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). You could also simply use your SendGrid username and password, but this is less secure.

You can adjust those settings for other SMTP providers, such as Gmail, Mandrill, etc. Please refer to the documentation of the corresponding provider to see what values should be used.

Configuration through the Admin UI

OpenProject allows you to configure your SMTP settings through the administration UI. Using the default admin account created when you first installed OpenProject, go to Administration > Emails and notifications.

At the bottom of this screen, you will find the following configuration form.

SMTP Options

These are the options that are available. Please see the Configuration guide and Environment variables guide on how to set these values from the command line.

OptionSettingENV nameDescription
Email delivery methodemail_delivery_methodOPENPROJECT_EMAIL__DELIVERY__METHODemail delivery method to be used (smtp, sendmail)
SMTP serversmtp_addressOPENPROJECT_SMTP__ADDRESSYour email SMTP server host name, for example: smtp.example.net
SMTP portsmtp_portOPENPROJECT_SMTP__PORTSMTP server port. Common options are 25 (plain) and 587 (SSL/TLS).
SMTP (HELO) domainsmtp_domainOPENPROJECT_SMTP__DOMAINFully-qualified domain name of the SMTP client. This commonly will be the host name of the OpenProject server.
SMTP authenticationsmtp_authenticationOPENPROJECT_SMTP__AUTHENTICATIONAuthentication method, possible values: none, plain, login, cram_md5
SMTP user namesmtp_user_nameOPENPROJECT_SMTP__USER__NAMEUser name for authentication against the SMTP server (when authentication is required)
SMTP passwordsmtp_passwordOPENPROJECT_SMTP__PASSWORDPassword for authentication against the SMTP server (when authentication is required)
Automatically use STARTTLSsmtp_enable_starttls_autoOPENPROJECT_SMTP__ENABLE__STARTTLS__AUTOYou can enable or disable STARTTLS here in case it doesn't work. Make sure you don't login to a SMTP server over a public network when using this. Recommended to leave this on if your server supports it. Possible values: true / false
OpenSSL verify modesmtp_openssl_verify_modeOPENPROJECT_SMTP__OPENSSL__VERIFY__MODEDefine how the SMTP server certificate is validated. Make sure you don't just disable verification here unless both, OpenProject and SMTP servers are on a private network. Possible values: none, peer, client_once or fail_if_no_peer_cert.
Note: This setting can only be set through ENV/settings
SMTP Timeoutsmtp_timeoutOPENPROJECT_SMTP__TIMEOUTThis optional setting allows you to specify the number of seconds to wait for SMTP connections to be opened and read.
If the value is set too low, a Net::OpenTimeout or Net::ReadTimeout might be raised.

Package-based installation (DEB/RPM)

If you installed OpenProject with the package-based installation, you can configure the above settings using the config:set helper. Please note that this will disable the settings in the administration UI.

shell
openproject config:set OPENPROJECT_EMAIL__DELIVERY__METHOD=smtp
openproject config:set OPENPROJECT_SMTP__ADDRESS=smtp.sendgrid.net
openproject config:set OPENPROJECT_SMTP__PORT=587
openproject config:set OPENPROJECT_SMTP__DOMAIN=my.domain.com
openproject config:set OPENPROJECT_SMTP__AUTHENTICATION=login
openproject config:set OPENPROJECT_SMTP__ENABLE__STARTTLS__AUTO=true
openproject config:set OPENPROJECT_SMTP__USER__NAME="apikey"
openproject config:set OPENPROJECT_SMTP__PASSWORD="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"

Docker installation

If you installed OpenProject with Docker, here is how you would enable outbound emails through the use of the SMTP environment variables (with SendGrid, the SMTP_USER_NAME is always apikey. Just replace SMTP_PASSWORD with the API key you've generated and you should be good to go). Please note that this will disable the settings in the administration UI.

shell
docker run -d \
  -e OPENPROJECT_EMAIL__DELIVERY__METHOD=smtp \
  -e OPENPROJECT_SMTP__ADDRESS=smtp.sendgrid.net \
  -e OPENPROJECT_SMTP__PORT=587 \
  -e OPENPROJECT_SMTP__DOMAIN=my.domain.com \
  -e OPENPROJECT_SMTP__AUTHENTICATION=login \
  -e OPENPROJECT_SMTP__ENABLE__STARTTLS__AUTO=true \
  -e OPENPROJECT_SMTP__USER__NAME="apikey" \
  -e OPENPROJECT_SMTP__PASSWORD="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" \
  ...

Sendmail

Requirements

You need to have Sendmail configured on your server. For information about how to configure Sendmail, please refer to the Sendmail docs

Configuration through the Admin UI

OpenProject allows you to configure your Sendmail through the administration UI. Using the default admin account created when you first installed OpenProject, go to Administration > Emails and notifications. Here, you need to change the Email delivery method to sendmail.

If you want to override the path where Sendmail is installed or change the command-line arguments, you can’t do this through the web frontend.
In this case, please use the variable shown in the next section to configure the path or arguments.

Sendmail Options

These are the options that are available. Please see the Configuration guide and Environment variables guide on how to set these values from the command line.

OptionSettingENV nameDescription
Email delivery methodemail_delivery_methodOPENPROJECT_EMAIL__DELIVERY__METHODemail delivery method to be used (smtp, sendmail)
Sendmail locationsendmail_locationOPENPROJECT_SENDMAIL__LOCATIONLocation of sendmail to call if it is configured as outgoing email setup. Default value: /usr/sbin/sendmail
Sendmail argumentssendmail_argumentsOPENPROJECT_SENDMAIL__ARGUMENTSArguments to call sendmail with in case it is configured as outgoing email setup. Default value: -i