Skip to content

Commit b855871

Browse files
committed
[add] discuss: specific email server from
1 parent 1168ba6 commit b855871

File tree

6 files changed

+277
-0
lines changed

6 files changed

+277
-0
lines changed

content/applications/productivity/discuss/advanced.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Advanced
88
:titlesonly:
99

1010
advanced/ice_servers
11+
advanced/email_servers
Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
============================================================
2+
How to Use my Mail Server to Send and Receive Emails in Odoo
3+
============================================================
4+
5+
If you are a user of Odoo Online or Odoo.sh...
6+
==============================================
7+
8+
You have nothing to do! **Odoo sets up its own mail servers for your database.** Outgoing and
9+
incoming emails work out-of-the-box!
10+
11+
Unless you plan to send large batches of mass mailing that could require the use of an external
12+
mail server, simply enjoy your new Odoo database.
13+
14+
Scope of this documentation
15+
===========================
16+
17+
This document is **mainly dedicated to Odoo on-premise users** who don't benefit from an
18+
out-of-the-box solution to send and receive emails in Odoo, unlike
19+
`Odoo Online <https://www.odoo.com/trial>`__ & `Odoo.sh <https://www.odoo.sh>`__.
20+
21+
.. warning::
22+
If no one in your company is used to manage email servers, we strongly recommend that you opt
23+
for those Odoo hosting solutions. Their email system works instantly and is monitored by
24+
professionals. Nevertheless you can still use your own email servers if you want to manage your
25+
email server's reputation yourself.
26+
27+
You will find here below some useful information on how to integrate your own email solution with
28+
Odoo.
29+
30+
.. note:: Office 365 email servers don't easily allow to send external emails from hosts like Odoo.
31+
Refer to `Microsoft's documentation <https://support.office.com/en-us/article/How-to-set-up-a-mu
32+
ltifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d65
33+
4b4c4>`__ to make it work.
34+
35+
How to manage outbound messages
36+
===============================
37+
38+
As a system admin, go to :menuselection:`Settings --> General Settings` and check
39+
:guilabel:`External Email Servers`. Then, click :guilabel:`Outgoing Mail Servers` to create one and
40+
reference the SMTP data of your email server. Once all the information has been filled out, click
41+
on :guilabel:`Test Connection`.
42+
43+
Here is a typical configuration for a G Suite server.
44+
45+
.. image:: email_servers/outgoing_server.png
46+
:align: center
47+
:alt: Connection information for a G Suite server
48+
49+
Then set your email domain name in the General Settings.
50+
51+
.. note::
52+
If you get a ```[AUTHENTICATIONFAILED] Invalid credentials (Failure)``` warning when you *Test
53+
Connection* on a Gmail address, activate the :guilabel:`Less secure app access` option. A direct
54+
link can be `accessed here <https://myaccount.google.com/lesssecureapps?pli=1>`_.
55+
56+
In addition to that, enable the IMAP setting on your Gmail account.
57+
58+
Can I use an Office 365 server
59+
------------------------------
60+
61+
You can use an Office 365 server if you run Odoo on-premise. Office 365 SMTP relays are not
62+
compatible with Odoo Online unless you configure Odoo to force the outgoing "From" address
63+
(see below).
64+
65+
Please refer to `Microsoft's documentation <https://support.office.com/en-us/article/How-to-set-up-
66+
a-multifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d
67+
54b4c4>`__ to configure a SMTP relay for your Odoo's IP address.
68+
69+
How to use a G Suite server
70+
---------------------------
71+
72+
You can use an G Suite server for any Odoo hosting type. To do so you need to setup the SMTP relay
73+
service. The configuration steps are explained in `Google documentation <https://support.google.com
74+
/a/answer/2956491?hl=en>`__.
75+
76+
Be SPF-compliant
77+
----------------
78+
79+
In case you use SPF (Sender Policy Framework) to increase the deliverability of your outgoing
80+
emails, don't forget to authorize Odoo as a sending host in your domain name settings. Here is the
81+
configuration for Odoo Online:
82+
83+
- If no TXT record is set for SPF, create one with following definition:
84+
`v=spf1 include:_spf.odoo.com ~all`
85+
- In case a SPF TXT record is already set, add `include:_spf.odoo.com`. e.g. for a domain name that
86+
sends emails via Odoo Online and via G Suite it could be:
87+
`v=spf1 include:_spf.odoo.com include:_spf.google.com ~all`
88+
89+
Find `here <https://www.mail-tester.com/spf/>`__ the exact procedure to create or modify TXT
90+
records in your own domain registrar.
91+
92+
Your new SPF record can take up to 48 hours to go into effect, but this usually happens more
93+
quickly.
94+
95+
.. note:: Adding more than one SPF record for a domain can cause problems with mail delivery and
96+
spam classification. Instead, we recommend using only one SPF record by modifying it to
97+
authorize Odoo.
98+
99+
Allow DKIM
100+
----------
101+
102+
You should do the same thing if DKIM (Domain Keys Identified Mail) is enabled on your email server.
103+
In the case of Odoo Online & Odoo.sh, you should add a DNS `odoo._domainkey` CNAME record to
104+
`odoo._domainkey.odoo.com`.
105+
106+
For example, "foo.com" should have a record
107+
"odoo._domainkey.foo.com" that is a CNAME with the value "odoo._domainkey.odoo.com".
108+
109+
Restriction
110+
-----------
111+
112+
Please note that the port 25 is blocked for security reasons. Try using 587, 465 or 2525.
113+
114+
Choose allowed "From" email addresses
115+
-------------------------------------
116+
117+
Sometimes, an email's "From" (outgoing) address can belong to a different domain, and that can be a
118+
problem.
119+
120+
For example, if a customer with address *mary@customer.example.com* responds to a message, Odoo will
121+
try to redistribute that same email to other subscribers in the thread. But if the domain
122+
*customer.example.com* forbids that kind of usage for security (kudos for that), the Odoo's
123+
redistributed email would get rejected by some recipients' mail servers.
124+
125+
To avoid those kind of problems, you should make sure all emails use a "From" address from your
126+
authorized domain.
127+
128+
If your MTA supports `Sender Rewriting Scheme <https://en.wikipedia.org/wiki/Sender_Rewritin
129+
g_Scheme>`_ (SRS), you can enable it to handle these situations. However, that is more complex and
130+
requires more technical knowledge that is not meant to be covered by this documentation.
131+
132+
Instead, you can also configure Odoo to do something similar by itself:
133+
134+
#. Set your domain name in the General Settings.
135+
136+
.. image:: email_servers/alias_domain.png
137+
:align: center
138+
:alt: Alias domain: mycompany.com
139+
140+
#. In developer mode, go to :menuselection:`Settings --> Technical --> Parameters -->
141+
System Parameters`.
142+
#. Add one system parameter from these:
143+
144+
- If you want *all* your outgoing messages to use the same "From" address, use the key
145+
`mail.force.smtp.from` and set that address as value(such as
146+
`outgoing@mycompany.example.com`).
147+
- If you want to keep the original "From" address for emails that use your same domain, but change
148+
it for emails that use a different domain, use the key `mail.dynamic.smtp.from` and set as
149+
value the email address that should be used in those cases (such as
150+
`outgoing@mycompany.example.com`).
151+
152+
How to manage inbound messages
153+
==============================
154+
155+
Odoo relies on generic email aliases to fetch incoming messages.
156+
157+
- **Reply messages** of messages sent from Odoo are routed to their original discussion thread (and
158+
to the inbox of all its followers) by the catchall alias (**catchall@**).
159+
- **Bounced messages** are routed to **bounce@** in order to track them in Odoo. This is especially
160+
used in `Odoo Email Marketing <https://www.odoo.com/page/email-marketing>`__ to opt-out invalid
161+
recipients.
162+
- **Original messages**: Several business objects have their own alias to create new records in
163+
Odoo from incoming emails:
164+
165+
- Sales Channel (to create Leads or Opportunities in `Odoo CRM <https://www.odoo.com/page/crm>`__),
166+
- Support Channel (to create Tickets in `Odoo Helpdesk <https://www.odoo.com/page/helpdesk>`__),
167+
- Projects (to create new Tasks in `Odoo Project <https://www.odoo.com/page/
168+
project-management>`__),
169+
- Job Positions (to create Applicants in `Odoo Recruitment <https://www.odoo.com/page/
170+
recruitment>`__),
171+
- etc.
172+
173+
Depending on your mail server, there might be several methods to fetch emails. The easiest and most
174+
recommended method is to manage one email address per Odoo alias in your mail server.
175+
176+
- Create the corresponding email addresses in your mail server (catchall@, bounce@, sales@, etc.).
177+
- Set your domain name in the General Settings.
178+
179+
.. image:: email_servers/alias_domain.png
180+
:align: center
181+
:alt: Alias domain: mycompany.com
182+
183+
- If you use Odoo on-premise, create an *Incoming Mail Server* in Odoo for each alias. You can do
184+
it from the General Settings as well. Fill out the form according to your email provider's
185+
settings. Leave the :guilabel:`Actions to Perform on Incoming Mails` blank. Once all the
186+
information has been filled out, click on :guilabel:`TEST & CONFIRM`.
187+
188+
.. image:: email_servers/incoming_server.png
189+
:align: center
190+
:alt: Server login and information settings
191+
192+
- If you use Odoo Online or Odoo.sh, We do recommend to redirect incoming messages to Odoo's domain
193+
name rather than exclusively use your own email server. That way you will receive incoming
194+
messages without delay. Indeed, Odoo Online is fetching incoming messages of external servers
195+
once per hour only. You should set redirections for all the email addresses to Odoo's domain name
196+
in your email server (e.g. *catchall@mydomain.ext* to *catchall@mycompany.odoo.com*).
197+
198+
.. tip:: All the aliases are customizable in Odoo.
199+
Object aliases can be edited from their respective configuration view. To edit catchall and
200+
bounce aliases, you first need to activate the :ref:`developer mode <developer-mode>`.
201+
202+
Then go to :menuselection:`Settings --> Technical --> Parameters --> System Parameters` to
203+
customize the aliases (*mail.catchall.alias* & * mail.bounce.alias*).
204+
205+
.. image:: email_servers/system_parameters.png
206+
:align: center
207+
:alt: System parameters catchall setting
208+
209+
.. note:: By default inbound messages are fetched every 5 minutes in Odoo on-premise.
210+
You can change this value in :ref:`developer mode <developer-mode>`. Go to
211+
:menuselection:`Settings --> Technical --> Automation --> Scheduled Actions`
212+
and look for :guilabel:`Mail: Fetchmail Service`.
213+
214+
.. _Office 365 documentation: https://support.office.com/en-us/article/how-to-set-up-a-multifunctio
215+
n-device-or-application-to-send-email-using-office-365-69f58e99-c550-4274-ad18-c805d654b4c4
216+
217+
Setting up different outgoing email servers for a multi-company environment
218+
===========================================================================
219+
220+
The "From Filter" allows for the use of a specific outgoing email server depending on the "From"
221+
email address that Odoo is sending on behalf of. When an email is sent from Odoo and the "From
222+
Filter" is configured, then the email server will be chosen as follows:
223+
224+
#. Odoo searches for an email server having the same "From Filter" as the "From" email address
225+
defined in the outgoing email. For example, if the "From" email address is test\@example.com,
226+
only the email servers having the "From Filter" equal to test\@example.com will be returned.
227+
228+
#. If no email servers are found, then Odoo searches for an email server having the same domain in
229+
the "From Filter" as in the "From" email address of the outgoing email. For example, if the
230+
"From" email address is test\@example.com, only the email servers having the "From Filter" equal
231+
to example.com will be returned.
232+
233+
If no email servers are found after checking for the domain, then Odoo will return all email
234+
servers without any "From Filter" set.
235+
236+
Should this previous query return no results, then Odoo performs a search for an email server
237+
using the system parameter: 'mail.default.from'. First, the email address listed will attempt
238+
to match an email server and then the domain will attempt a match.
239+
240+
If no email server is found then Odoo will return the first outgoing email server (sorted by
241+
priority). In this case, it is likely the email configuration will be spoofing the email and it
242+
will be flagged as Spam.
243+
244+
.. note::
245+
If several email servers are found, then Odoo will use the first one according to its priority.
246+
For example, if there are two email servers, one with a priority of 10 and the other with a
247+
priority of 20, then the email server with a priority of 10 will be used.
248+
249+
Set up different dedicated servers for transactional and mass mails
250+
===================================================================
251+
252+
Odoo's e-mail server has the capability of sending 200 e-mails per day on Odoo SH Cloud Platform.
253+
However, if needed, you can use a separate Mail Transfer Agent (MTA) servers for transactional
254+
e-mails and mass mailings.
255+
256+
Example: use Odoo's own mail server for transactional e-mails, and Sendgrid, Amazon SES, or Mailgun
257+
for mass mailings. Another alternative is to use Postmark for transactional e-mails, and Amazon SES
258+
or Sendgrid for mass mailings.
259+
260+
.. note::
261+
A default outgoing email server is already configured. You should not create an alternative one
262+
unless you want to use a specific external outgoing email server for technical reasons.
263+
264+
To do this, you should first activate the :ref:`developer mode <developer-mode>` and then go to
265+
:menuselection:`Settings --> Technical --> Outgoing` e-mail servers. There you have to create two
266+
e-mail MTA server settings. One for transactional e-mails and one for mass mail servers. Be sure to
267+
mark the priority of transactional e-mail servers as low as the mass email servers.
268+
269+
Now, go to :menuselection:`Email Marketing --> Settings` and enable :guilabel:`Dedicated Server`.
270+
With these settings, Odoo uses the server with the lower priority for transactional emails, and the
271+
server here selected for mass mails.
272+
273+
Note that in this case, you have to set your domain's Sender Policy Framework (SPF) records to
274+
include both transactional and mass mail servers. If your server resides with xxxx.odoo.com, the
275+
available options are Sendinblue and Mailchimp, as your e-mails would be originated from the
276+
mycompany.odoo.com domain.
2.58 KB
Loading
36.9 KB
Loading
42.6 KB
Loading
58.5 KB
Loading

0 commit comments

Comments
 (0)