Setup EMails

Help about screen: EMail setup

Menu path: Home ► Setup ► EMails


The EMails setup screen allows you to setup Dolibarr to send EMails and to test your setup.

E-Mails setup parameters

 
Emails Setup

This is explanation of all setup parameters:

Disable globally all emails sendings (test mode or demo)

Set this to No. If you set to yes (for a demo system for example), no more mail will be sent.

Send all emails to (instead of real recipients, for test purposes)

Enter an email address. All the outgoing emails will be sent to that address. For test purpose.

Suggest emails of employees

Suggest emails of employees (if defined) into the list of predefined recipient when writing a new email

Method to send emails

  • The default method is PHP mail function. This means that Dolibarr use your PHP to send emails. This suppose your PHP setup is complete. If you don't know how to setup PHP for email sending, prefer next method.
  • If your email sending server needs authentication, or if you don't have permission or knowledge to setup your PHP, choose the second method: SMTP/SMTPS socket library (or Swift Mailer socket library if you fails to make the previous one working with your email provider).

  WARNING

Some email provider (like Yahoo) does not allow you to send an email from another server than the Yahoo server if the email address used as a sender is a Yahoo email (for example myemail@yahoo.com, myemail@yahoo.fr, ...). If you use the PHPmail method, it means you will use the server of your application to send emails, so some recipients (the one compatible with DMARC protocol), will ask Yahoo if they can accept your email and Yahoo will respond "no" because the server is not a Yahoo server, and some of your Emails may not be received.
If like Yahoo, your Email provider has this restriction, you must set this setup to choose the other method "SMTP/SMTPS socket library" and enter here the SMTP server and credentials provided by your Email provider.

Hostname or ip address of SMTP/SMTPS sending server

Name or IP address of the server that send mail. It is usually an name like smtp.xxx.zzz provided by your Internet Service Provider.

For example:

  • smtp.aol.com
  • smtp.free.fr
  • smtp.myprovider.com
  • smtp.gmail.com (with login/pass of gmail or gmail for works account)
  • smtp-relay.gmail.com (with mode relay of gmail for works)

Port of SMTP/SMTPS sending server

If the email sending server use the standard port (25), you can let the field empty.

Other examples:

  • 25 (SMTP standard)
  • 465 (SMTPS gmail of free Gmail or Gmail Suite)
  • 25, 465 or 587 (SMTP gmail with the mode relay available with Gmail Suite, depending on setup)

SMTP Authentification ID

Visible if you have choose SMTP/SMTPS socket library as sending method. Put here your login.

SMTP Authentification Password

Visible if you have choose SMTP/SMTPS socket library as sending method. Put here your password.

Usage of TLS (SSL)

Some emails servers require encrypted communication (For example the SMTP server of Google smtp.gmail.com. It's SMTPS).

The only method that support this protocol is SMTP/SMTPS socket library. You must enable cryptography by setting this method if you need such encryption.

Note: SSL functions must be available in your PHP. If not, you probably forget to install the openssl module of PHP.

Note: There is 2 different types of SMTP secured encoding:

  • Sending SMTP protocol inside a crypted stream (SSL or non standard TLS). Server is often running on port 465.
  • Sending crypted data inside SMTP (TLS using STARTTLS). Server is often running on port 587.

More information on difference between TLS and STARTTLS here: https://www.fastmail.com/help/technical/ssltlsstarttls.html

EMail used as sender for automatic emails

Set here the eMail that will be used by default by Dolibarr as eMail sender for automatic emails, if sender is not explicitly defined.

Default sender email for manual sending

You can use User email or Company email

Email used for error returns emails

Set an error returns email address (fields 'Errors-To' in emails sent). All the emails that has not been properly received, will be sent back to this address

Copy (Bcc) all sent emails to

If you want to have all the Dolibarr outgoing email sent in copy to a general mail address

Examples for common Mail server setup

This is some examples of values (for common email providers) to use to setup your emails with the SMTPs method and use the SMTP server of your email provider. Contact your email provider if it is not in this list (or if you are not sure of which value to use) to ask him the credentials (SMTP server, port, Use of TLS or not).

Gmail (with login and pass or application)

  • SMTP server: smtp.gmail.com
  • Port: 465
  • Authentication method: Use a password (AUTH LOGIN)
  • SMTP Username: Your Gmail login (xxx@gmail.com or xxx@yourdomain.com)
  • SMTP Password: A generated application password, without the spaces (NOT your GMail password, see later)
  • Use TLS (SSL) encrypt: yes
  • Use TLS (STARTTLS) encrypt: no

  Because using this SMTPS access need to store a login/pass into the application, this access is classified by Google as a "less secured access". So check that such access is enabled for your Google account: Take a look at your dashboard for parameter: "Access for less secured application" on https://www.google.com/settings/security/lesssecureapps.

You must enable the 2-steps authentication on your Google account. Once done, you must create a dedicated alternative password for your account. This can be done on: https://myaccount.google.com/security, menu "Application password". Create the alternative password. You must then use it instead of your standard Gmail password into setup (the login that is the main email does not change).

  If you have email aliases on your account, be sure to set as login, the main username/email and not the alias.

  Note also that when sending email with google smtps, if the email of sender is not the google email, neither a declared alias, google will replace the "From" visible by the recipient with your default email alias (but the reply to will still be the sender email even if not declared)

Note: With this mode, all sent emails are automatically added into "Sent" folder of the main account. If your are a Gsuite user with several users/mailboxes, prefer to use the next method.

Gmail (with OAuth2)

Enable the module OAuth2. Into OAUTH2 module setup, create an OAuth2 entry for Google provider with the 3 scopes:

Go on the Tab Token Management to generate a token for this OAUth2 service.

Now, into the Home - Setup - Email must be

  • Email sending method: SMTPs
  • Server: smtp.gmail.com
  • Authentication method: OAUTH2
  • User name: Your Gmail login (xxx@gmail.com or xxx@yourdomain.com)
  • OAUTH2 authentication service: Choose the entry created in OAUth2 setup
  • Port: 587
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Gmail (with mode relay of Gmail with Google Workspace - GSuite)

If you are a Gsuite user with several users/mailboxes, this mode is required if you want to have each user having its sent mails automatically stored into its own "Sent" directory of Gmail.

  • SMTP server: smtp-relay.gmail.com
  • Port: 587 (Note from Google doc: If you use TLS: 587, if you don't use TLS: 25, 465 or 587)
  • Authentication method: Use a password (AUTH LOGIN)
  • Use TLS: Depend on relay setup
  • Login/Pass: Keep login/pass empty (Choice A). In such case, on your Google console for email, you must set "Allow some IP addresses only" and enter the public IP of your Dolibarr server (see later). Or (choice B) enter your GSuite email account and an "application" password that is not the password of your account but a second password generated from https://myaccount.google.com/security).

Note 1: You must first setup your Google account to relay outgoing email and to set the list of ip of your SMTP clients (https://admin.google.com, Apps/Application - GMail - Routing - SMTP Relay service). Then choose "Accept all emails from my domain" or "Accept all", Choose "Enable TLS" and choose "SMTP authentication required" to no (Choice A) or yes (Choice B).

  • If you made Choice A, you must also enter the public ip address of the server of your Dolibarr in "Allow some IP addresses only".
  • If you made Choice B, you must create an "application password" from https://myaccount.google.com/security and use this one. (2FA needs to be enabled in order to be able to create "application passwords")

Whatever is the choice (A or B), you will never have to enter the real password of your Google account inside Dolibarr setup when using the GMail relay solution.

Note 2: With this mode (A or B), emails sent can also be saved into the "Sent" folder if option "Stock a copy of all emails sent..." is on.

Note 3: If you try the choice A and got the error

550-5.7.1 Invalid credentials for relay [x:y:z:a:b:c:d:e]. The IP 
550-5.7.1 address you've registered in your G Suite SMTP Relay service doesn't
550-5.7.1 match domain of the account this email is being sent from. If you are 
550-5.7.1 trying to relay mail from a domain that isn't registered under your G 
550-5.7.1 Suite account or has empty envelope-from, you must configure your 
550-5.7.1 mail server either to use SMTP AUTH to identify the sending domain or 
550-5.7.1 to present one of your domain names in the HELO or EHLO command. For 
550-5.7.1 more information, please visit 
550 5.7.1  https://support.google.com/a/answer/6140680#invalidcred m24-20020a056512359800b004b22b1d52e4sm82237lfr.66 - gsmtp

Then you can try to disable the "Enable TLS" OR try to add the use of an application password (so you will use a choice A+B)

Note 4: for google workspace accounts, if you enable an automatic signature in the console admin.google.com - Apps - Gmail - Append footer, the signature content will be added after any email sent from the SMTP gateway. Because Dolibarr may also add one if you added it into your templates or manually in your messages, you may have duplicate signatures.

iCloud

iCloud does not support SSL/TLS, only TLS with STARTTLS.

Setup would be:

  • Server: smtp.mail.me.com
  • Port: 587
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your iCloud Mail email address (Do include the domain name—what follows "@" in your iCloud Mail address; if your iCloud Mail email address is "me@icloud.com", for instance, do use "me@icloud.com" as the user name.)
  • Password: iCloud Mail SMTP password: Your iCloud Mail password or an app-specific password (with two-step authentication enabled)
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Gandi

Setup would be:

  • Server: mail.gandi.net
  • Port: 587
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your email address of your Gandi account
  • Password: Your password of your Gandi account
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Orange

Setup would be:

  • Server: smtp.orange.fr
  • Port: 25
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your email address of your Orange account (ex: myname@wanadoo.fr)
  • Password: Your password of your Orange account
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: no

Outlook / Office365 / Exchange server (with login/pass)

It is also called the SMTP AUTH method or Option 1 in this Microsoft Tutorial. Warning, according to Microsoft doc, this method is limited: It supports only 1 possible sender. Any other email used to send email will appear as the same main sender.

Setup may be:

  • Server: smtp.office365.com (Microsoft Office 365, Exchange Server) and smtp-mail.outlook.com
  • Port: 587
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: The main email account
  • Password: Your password account (If you enabled the Double Authentication Method, you must create an "Application password" from menu https://account.microsoft.com/security/ -> "More security options" and use it as the password instead of your common password)
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes
  • You must also go on the microsoft admin console and for each email, you must allow sending from an external platform. For this, on https://admin.microsoft.com go on User file - Mail - Allow as.... Add permissions and add also the main generic email account.
  • You must also allow the application "SMTP" to reach your account. For this, on https://admin.microsoft.com, go on User file - Mail - Manage mail application and check to allow 'SMTP authenticated'.

Note: Outlook and Office365 are the worst platforms we know to manage emails. It is not compliant with most web and emails standard so the setup is often difficult with this platform. Documentation about SMTP credential is also poor. It depends on a lot of parameters saved into your Outlook platform. Ask the parameters to use the SMTP server of your Outlook/Office365 platform to your Outlook/Office365 provider. Only your Outlook/Office365 provider is able to give you those parameters. If you can't contact him, I'm afraid, trying any combination of parameters is the only solution to find the good one with this email platform but the one suggested in this wiki should works in 90% of the cases (note that some other parameters specific to Office365 may also be expected by the platform, ask your Microsoft integrator).

This is a more complete thread about this setup reported by a French user: https://www.dolibarr.fr/forum/t/envoi-de-mail-depuis-un-smtp-office365/29299/15?u=eldy

  If you got error:

Response: 501 5.5.4 Invalid domain name [...]

Error after sending EHLO xxxxxx:4435 : 501

the problem is not into your authentication because error is before that, at very begin of protocol. Try to go on Home - Setup - Other and add MAIL_SMTP_USE_FROM_FOR_HELO to value 1 so Dolibarr will use the domain in the from email as the HELO string, or 0 so Dolibarr will use "smtp.office365.com"

Outlook / Office365 / Exchange server (with OAuth2)

Enable the module OAuth2. Into OAUTH2 module setup, create an OAuth2 entry for Microsoft provider with the 3 scopes:

  • offline_access
  • outlook.office365.com/IMAP.AccessAsUser.All
  • outlook.office365.com/SMTP.Send

Go on the Tab Token Management to generate a token for this OAUth2 service.

Now, into the Home - Setup - Email must be

  • Email sending method: SMTPs
  • Server: smtp.office365.com (Microsoft Office 365, Exchange Server) and smtp-mail.outlook.com
  • Port: 587
  • User name: The main email account
  • Authentication method: OAUTH2
  • OAUTH2 authentication service: Choose the entry created in OAUth2 setup
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Outlook / Office365 / Exchange server (with mode relay)

This method needs a complex Microsoft Office365 setup (creation of a "Microsoft SMTP Connector"). Also, with this method, Office365 is not able to keep the email sent into the directory "Sent" of the user that send the email. This is a serious limitation for companies with several mailboxes. We recommend using another email provider if you need this (for example gmail that has not this limit). This mode is compatible with the two factor authentication. More information available on Option 3 variante 2 of this Microsoft Tutorial

Setup may be (see however note after):

  • Server: yourdomainname.mail.protection.outlook.com
  • Port: 25
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Keep empty
  • Password: Keep empty
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: no or yes

Note: You must add a rule in office365 to accept SMTP e-mail without authentication but with a restriction on the IP address of the server hosting your Dolibarr application.

OVH

Setup would be:

  • Server: exX.mail.ovh.net (ask OVH to know value of X)
  • Port: 587
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your email
  • Password: Your email password (not your OVH account password)
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Some users also succeed with:

  • Server: sslX.ovh.net (ask OVH to know value of X)
  • Port: 465
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your email
  • Password: Your email password (not your OVH account password)
  • Use TLS (SSL) encrypt: yes
  • Use TLS (STARTTLS) encrypt: no

Proton Mail

According to this documentation: https://proton.me/support/smtp-submission, setup would be:

  • Server: smtp.protonmail.ch
  • Authentication method: AUTH PLAIN (on Dolibarr < 20, you must also go into the page Home - Setup - Other setup" and add the entry with name = "MAIN_MAIL_SMTPS_AUTH_TYPE" and value = "PLAIN" to use this mode)
  • User name: The email address that appears into the field SMTP username when you create a SMTP token (See this page to see how to create a token: https://proton.me/support/smtp-submission)
  • Password: The value of the SMTP token
  • Port: 587
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Note: All emails sent will appears automatically into your "Sent" folder.

SendGrid

Setup would be:

  • Server: smtp.sendgrid.net
  • Port: 2525
  • Authentication method: Use a password (AUTH LOGIN)
  • User name: Your SendGrid api key
  • Password: Your SendGrid api pass
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Warning: sendgrid is used mostly for mass emailings. So if you don't subscribe to a paying private IP, your mails may be flagged as spam by recipients event if your email is not.

Yahoo (with login/pass)

  • SMTP server: smtp.mail.yahoo.com
  • Port: 465
  • Authentication method: Use a password (AUTH LOGIN)
  • SMTP Username: Your Yahoo login (xxx@yahoo.com)
  • SMTP Password: The alternative application password, see later
  • Use TLS (SSL) encrypt: yes
  • Use TLS (STARTTLS) encrypt: no

  Because using this smtps access need to store your login/pass into application, this access is classified by Yahoo as a "less secured access".

You need to create a dedicated password for the application : on Yahoo go on "Personal Information"->"Account Security"->"Manage application passwords".

In the list, select an application of your choice for Dolibarr, for exempel "Android Mail" then click on "generate" In the new window that opens copy the password and paste it on the Dolibarr Email setup

Several SMTP logins or servers per user

As this method is, nowadays, not recommended, this feature is not provided.

Note: Even if each user has its own email address, its own mailbox and its own "Sent" directory, using several SMTP login/servers is not required (see for example the comment for Gmail setup using the "relay" mode). You must use instead an enterprise SMTP service that offers several mailboxes but with one authentication mode (this is available with all emails providers nowadays)

Actions

Test server availability

This button is to test if you can communicate with the server. This allow you validate the parameter:

  • Hostname or ip address of SMTP/SMTPS sending server
  • Port of SMTP/SMTPS sending server
  • Usage of TLS (SSL)

Test send email

This button is to test what happens when you send an email with simple text content.

Test send email HTML

This button is to test what happens when you send an email with HTML content.

SPAM troubles

If your email is set as SPAM by your EMail reader, you can test to send en email to this service to get more information why your email is set as SPAM: https://www.mail-tester.com/

Outgoing email setup (for module EMailing)

This tab allows you to change the email setting of the Mass EMailing module. By default, it uses the same settings defined in the previous tab.

Email templates

 
Email Template Setup

This tab allows you to create email template that will be proposed on specific modules or globally. You can either create new template or modify existing templates.

Create an email template

To create an email template, you have several fields to fill :

  • Code of the template : Code is free to define
  • Language : Language of the template
  • Type of template : Email template can be dedicated to modules or visible globally
  • Owner of the template
  • Private : If set to private, only the owner will see the template
  • Position : Position of the template on the list (1 being the top position)
  • Subject of the email : Variable substitution system can be used
  • Attach file : If the email is sent from a screen where a document is available, the document will be immediately added to mail if you enter "1".
  • Content of the email : Variable substitution system can be used

Modify an existing email template

On the email template list, you can :

  • See the resume of the template
  • Activate or deactivate the template by clicking on the Status column
  • Modify the template by clicking on the pencil icon
  • Delete the template by clicking on the garbage icon

Emails sender profiles

You can keep this section empty. If you enter some emails here, they will be added to the list of possible senders into the combobox when your write a new email.

Emails Tracking

Like most modern ERP and email clients, all emails sent by Dolibarr contains a header line "Reference" with a tracking information to know from which source element the email were sent. This tracking informations will also be present into the emails answer, but only if the reader has sent the answer using the "Reply / Answer" feature of its email reader and not by creating a new email from scratch of course. This tracking id can be used by the Module EMail Collector that scan your mailbox and can automatically store the answer or email sent as en event, lead, ticket or candidature in your Dolibarr, at the good place (so it is automatically linked to the related customer and/or quotation for example).