Setup EMails

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search

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
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.png 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 sue 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 Dolibarr as emails sender, 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/pass or login/pass of application)

  • SMTP server: smtp.gmail.com
  • Port: 465
  • SMTP Username: Your Gmail login (xxx@gmail.com or xxx@yourdomain.com)
  • SMTP Password: Your Gmail password (or the alternative application password, see later)
  • Use TLS (SSL) encrypt: yes
  • Use TLS (STARTTLS) encrypt: no

Warning.png Because using this smtps access need to store your login/pass into 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.

If the 2-steps authentication is enabled, this parameter is always Disabled. In such a case, you must create a dedicated second password for your account. This can be done on: https://myaccount.google.com/security, menu "Application password". Create a dedicated password. You must then use it instead of your standard Gmail password into setup (the login does not change).

Also note that Google will probably close the feature to use the "less secured access" in february 2021. You would have to use the "Application password" or use the next method if you are a Google Workspace - GSuite user (Gmail with relay server).

Warning.png If you have email aliases on your account, be sure to set here the main username and not the alias.

Warning.png 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, emails sent 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 mode relay of Gmail with Google Workspace - GSuite)

  • SMTP server: smtp-relay.gmail.com
  • Port: 25, 465 or 587
  • Use TLS: Depend on relay setup
  • Login/Pass: Keep login/pass empty (Choice A). In such case, you must set "Allow some IP addresses only" and enter the public IP of your Dolibarr server. 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, Application - GSuite - GMail - Advanced setup - Routing). 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 password of your Google account when using the GMail relay solution.

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

If your 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.

iCloud

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

Setup would be:

  • Server: smtp.mail.me.com
  • 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)
  • Port: 587
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

Gandi

Setup would be:

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

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

This mode is not compatible with the two factor authentication.

Setup may be (see however note after):

  • Server: smtp.office365.com (Microsoft Office 365, Exchange Server) and smtp-mail.outlook.com
  • User name: Your 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)
  • Port: 587
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

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 platform to your Outlook provider. Only your Outlook provider is able to give you this 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: Some users has reported that you may solve trouble in user/password validation by adding 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.

Outlook / Office365 / Exchange server (with mode relay)

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 this page

Setup may be (see however note after):

  • Server: yourdomainname.mail.protection.outlook.com
  • User name: Keep empty
  • Password: Keep empty
  • Port: 25
  • 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)
  • User name: Your email
  • Password: Your email password
  • Port: 587
  • Use TLS (SSL) encrypt: no
  • Use TLS (STARTTLS) encrypt: yes

SendGrid

Setup would be:

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

Yahoo (with login/pass)

  • SMTP server: smtp.mail.yahoo.com
  • Port: 465
  • 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

Warning.png 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 past it on the Dolibarr Email setup

Several smtp logins or servers

If you need to have each user to use a different SMTP login account or a different SMTP server, you might be interested into the module MULTISMTP: https://www.dolistore.com/en/moduliplugin/458-MultiSMTP.html Note that in most cases, even if each user has its own email address and its own mailbox and "Sent" directory, using several SMTP login/servers is not required (see for example the comment for Gmail setup using the "relay" mode).

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
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 sent the answer using the "Answer to" 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 (on related customer and quotation for example).