Cấu hình bản ghi DNS để gửi email trong Odoo

Tài liệu này trình bày ba giao thức xác thực bổ sung (SPF, DKIM và DMARC) được sử dụng để chứng minh tính hợp pháp của người gửi email. Việc không tuân thủ các giao thức này sẽ làm giảm đáng kể khả năng email của bạn đến được đích.

Cơ sở dữ liệu Odoo OnlineOdoo.sh sử dụng địa chỉ tên miền phụ Odoo mặc định (ví dụ: @company-name.odoo.com) được cấu hình sẵn để gửi email đã xác thực tuân thủ các giao thức SPF, DKIM và DMARC.

Nếu chọn sử dụng tên miền tùy chỉnh, việc cấu hình bản ghi SPF và DKIM chính xác là cần thiết để ngăn email bị cách ly như thư rác hoặc không được gửi đến người nhận.

Nếu sử dụng máy chủ email Odoo mặc định để gửi email từ tên miền tùy chỉnh, bản ghi SPF và DKIM phải được cấu hình như trình bày bên dưới. Nếu sử dụng máy chủ email đi riêng, bạn cần sử dụng bản ghi SPF và DKIM dành riêng cho dịch vụ email đó và tên miền tùy chỉnh.

Ghi chú

Các nhà cung cấp dịch vụ email áp dụng các quy tắc khác nhau đối với email đến. Email có thể bị phân loại là thư rác ngay cả khi đã vượt qua kiểm tra SPF và DKIM.

SPF (Sender Policy Framework)

Giao thức Khung chính sách người gửi (SPF) cho phép chủ sở hữu của một tên miền chỉ định những máy chủ nào được phép gửi email từ miền đó. Khi một máy chủ nhận được email đến, nó sẽ kiểm tra xem địa chỉ IP của máy chủ gửi có nằm trong danh sách các IP được phép theo bản ghi SPF hay không.

Trong Odoo, kiểm tra SPF được thực hiện trên địa chỉ trả lại được xác định trong trường Tên miền bí danh nằm trong Cài đặt chung của cơ sở dữ liệu. Nếu sử dụng tên miền tùy chỉnh làm Tên miền bí danh, bạn cần cấu hình để tuân thủ SPF.

The SPF policy of a domain is set using a TXT record. The way to create or modify this record depends on the provider hosting the DNS zone of the domain name.

If the domain name does not yet have an SPF record, create one using the following input:

v=spf1 include:_spf.odoo.com ~all

If the domain name already has an SPF record, the record must be updated. Do not create a new one, as a domain must have only one SPF record.

Example

If the TXT record is v=spf1 include:_spf.google.com ~all, edit it to add include:_spf.odoo.com: v=spf1 include:_spf.odoo.com include:_spf.google.com ~all

Check the SPF record using a tool like MXToolbox SPF Record Check. The process to create or modify an SPF record depends on the provider hosting the DNS zone of the domain name. The most common providers and their documentation are listed below.

DKIM (DomainKeys Identified Mail)

The DomainKeys Identified Mail (DKIM) allows a user to authenticate emails with a digital signature.

Khi gửi email, máy chủ email Odoo bao gồm chữ ký DKIM duy nhất trong phần header. Máy chủ của người nhận giải mã chữ ký này bằng cách sử dụng bản ghi DKIM trong tên miền của cơ sở dữ liệu. Nếu chữ ký và khóa có trong bản ghi khớp nhau, điều đó chứng minh thông điệp là xác thực và không bị thay đổi trong quá trình truyền tải.

Enabling DKIM is required when sending emails from a custom domain using the Odoo email server.

Thêm bản ghi CNAME cho tên miền

Để bật DKIM, thêm bản ghi tên chuẩn (CNAME) vào vùng hệ thống tên miền (DNS) của tên miền:

odoo._domainkey IN CNAME odoo._domainkey.odoo.com.

Nếu tên miền là company-name.com, hãy đảm bảo tạo bản ghi CNAME trong đó bản ghi CNAME (khóa/tên) là odoo._domainkey.company-name.com và tên chuẩn (giá trị/nội dung) là odoo._domainkey.odoo.com.. Ví dụ, lưu ý sự khác biệt giữa mỗi khóa/giá trị in nghiêng:

Ví dụ bản ghi CNAME

Khoá

odoo._domainkey

Giá trị

odoo._domainkey.odoo.com. 

HOẶC

odoo._domainkey.dbname.odoo.com.

... trong đó dbname là tên của cơ sở dữ liệu Odoo.

Trên hầu hết các nền tảng DNS, nhà cung cấp DNS tự động thêm tên miền tùy chỉnh (ví dụ: company-name.com). Trong trường hợp này, khóa trông khác đi nhưng giá trị vẫn giữ nguyên:

Ví dụ bản ghi CNAME với tên miền tùy chỉnh

Khoá

odoo._domainkey.company-name.com 

... trong đó company-name.com là tên miền tùy chỉnh.

Giá trị

odoo._domainkey.odoo.com. 

HOẶC

odoo._domainkey.dbname.odoo.com.

... trong đó dbname là tên của cơ sở dữ liệu Odoo.

Ghi chú

Nếu nhà cung cấp DNS không thêm tên miền tùy chỉnh theo mặc định, hãy đảm bảo bao gồm nó.

Thêm bản ghi CNAME cho tên miền phụ

Nếu có tên miền phụ (ví dụ: marketing trong marketing.company-name.com), hãy thêm bản ghi CNAME để bao gồm nó nhằm tuân thủ:

Ví dụ bản ghi CNAME với tên miền phụ

Khoá

odoo._domainkey.*marketing*|nbsp|

... trong đó marketing là tên miền phụ.

HOẶC

odoo._domainkey.marketing.*company-name.com*|nbsp|

... trong đó company-name.com là tên miền tùy chỉnh.

Giá trị

odoo._domainkey.odoo.com. 

HOẶC

odoo._domainkey.dbname.odoo.com.

... trong đó dbname là tên của cơ sở dữ liệu Odoo.

Xem tài liệu nhà cung cấp DNS

The way to create or modify a CNAME record depends on the provider hosting the DNS zone of the domain name. The most common providers and their documentation are listed below.

Kiểm tra xem bản ghi DKIM có hợp lệ hay không bằng công cụ như `MXToolbox DKIM Record Lookup<https://mxtoolbox.com/dkim.aspx>`_. Nhập example.com:odoo vào công cụ tra cứu DKIM, chỉ định rằng selector đang được kiểm tra là odoo cho tên miền tùy chỉnh example.com.

DMARC (Domain-based Message Authentication, Reporting and Conformance)

The DMARC record is a protocol that unifies SPF and DKIM. The instructions contained in the DMARC record of a domain name tell the destination server what to do with an incoming email that fails the SPF and/or DKIM check.

Ghi chú

The aim of this documentation is to help understand the impact DMARC has on the deliverability of emails, rather than give precise instructions for creating a DMARC record. Refer to a resource like DMARC.org to set the DMARC record.

There are three DMARC policies:

  • p=none

  • p=quarantine

  • p=reject

p=quarantine and p=reject instruct the server that receives an email to quarantine that email or ignore it if the SPF or DKIM check fails.

Ghi chú

For the DMARC to pass, the DKIM or SPF check needs to pass and the domains must be in alignment. If the hosting type is Odoo Online, DKIM configuration on the sending domain is required to pass the DMARC.

Passing DMARC generally means that the email will be successfully delivered. However, it's important to note that other factors like spam filters can still reject or quarantine a message.

p=none is used for the domain owner to receive reports about entities using their domain. It should not impact the deliverability.

Example

_dmarc IN TXT “v=DMARC1; p=none; rua=mailto:postmaster@example.com” means that aggregate DMARC reports will be sent to postmaster@example.com.

SPF, DKIM and DMARC documentation of common providers

To fully test the configuration, use the Mail-Tester tool, which gives a full overview of the content and configuration in one sent email. Mail-Tester can also be used to configure records for other, lesser-known providers.