Mẫu Email

Email templates are saved emails that are used repeatedly to send emails from the database. They allow users to send quality communications, without having to compose the same text repeatedly.

Creating different templates that are tailored to specific situations lets users choose the right message for the right audience. This increases the quality of the message and the overall engagement rate with the customer.

Ghi chú

Mẫu email trong Odoo sử dụng QWeb hoặc XML, cho phép chỉnh sửa email trong giao diện hiển thị cuối cùng, giúp tùy chỉnh linh hoạt hơn mà không cần chỉnh sửa bất kỳ mã nào. Điều này có nghĩa là Odoo có thể sử dụng Giao diện người dùng đồ họa (GUI) để chỉnh sửa email, đồng thời cập nhật mã backend. Khi email được người nhận đọc trong chương trình của họ, định dạng và đồ họa sẽ hiển thị đúng theo thiết kế cuối cùng.

Access email templates in developer mode by navigating to Settings app ‣ Technical menu ‣ Email ‣ Email Templates.

Chỉnh sửa mẫu email

The powerbox feature can be used when working with email templates. This feature provides the ability to directly edit the formatting and text in an email template, as well as the ability to add links, buttons, appointment options, or images.

Additionally, the XML/HTML code of the email template can be edited directly, via the </> icon. Dynamic placeholders (referencing fields within Odoo) are also available for use in the email template.

Powerbox

The powerbox feature is an enriched text editor with various formatting, layout, and text options. It can also be used to add XML/HTML features in an email template. The powerbox feature is activated by typing a forward slash / in the body of the email template.

When a forward slash / is typed in the body of an email template, a drop-down menu appears with the following options:

Cấu trúc

  • Bulleted list: Create a simple bulleted list.

  • Numbered list: Create a list with numbering.

  • Checklist: Track tasks with a checklist.

  • Table: Insert a table.

  • Separator: Insert a horizontal rule separator.

  • Quote: Add a blockquote section.

  • Code: Add a code section.

  • 2 columns: Convert into two columns.

  • 3 columns: Convert into three columns.

  • 4 columns: Convert into four columns.

Định dạng

  • Heading 1: Big section heading.

  • Heading 2: Medium section heading.

  • Heading 3: Small section heading.

  • Switch direction: Switch the text's direction.

  • Văn bản: Khối đoạn văn.

Phương tiện

  • Image: Insert an image.

  • Article: Link an article.

Điều hướng

  • Link: Add a link.

  • Button: Add a button.

  • Appointment: Add a specific appointment.

  • Calendar: Schedule an appointment.

Tiện ích

  • 3 Stars: Insert a rating over three stars.

  • 5 Stars: Insert a rating over five stars.

Khối cơ bản

  • Signature: Insert your signature.

Công cụ Marketing

  • Dynamic Placeholders: Insert personalized content.

Mẹo

To use any of these options, click on the desired feature from the powerbox drop-down menu. To format existing text with a text-related option (e.g. Heading 1, Switch direction, etc.), highlight the text, then type in the activator key (forward slash) /, and select the desired option from the drop-down menu.

Powerbox feature in the email template.

Trình soạn thảo mã HTML/XML

To access the XML/HTML editor for an email template, first enter developer mode. Then, click the </> icon in the upper-right corner of the template, and proceed to edit the XML/HTML. To return to the standard text editor, click the </> icon again.

HTML editor in the email template.

Cảnh báo

The XML/HTML editor should be accessed with caution as this is the backend code of the template. Editing the code can cause the email template to break immediately or when upgrading the database.

Trình giữ chỗ động

Dynamic placeholders reference certain fields within the Odoo database to produce unique data in the email template.

Example

Nhiều công ty thích tùy chỉnh email của họ bằng một thông tin cá nhân hóa về khách hàng để thu hút sự chú ý. Điều này có thể được thực hiện trong Odoo bằng cách tham chiếu một trường trong mô hình bằng cách chèn một phần giữ chỗ động. Ví dụ: tên của khách hàng có thể được tham chiếu trong email từ trường Khách hàng trên mô hình Đơn bán hàng. Phần giữ chỗ động cho trường này là: {{ object.partner_id }}.

Dynamic placeholders are encoded to display fields from within the database. Dynamic placeholders can be used in the Body (Content Tab) of the email template. They can also be used in the fields present in the Email Configuration tab, the Subject of the email, and the Language.

Để sử dụng phần giữ chỗ động trong phần Thân của email, hãy mở tính năng powerbox bằng cách nhập / vào phần thân của mẫu email trong tab Nội dung. Cuộn xuống cuối danh sách tùy chọn, đến Công cụ marketing. Tiếp theo, chọn Phần giữ chỗ động. Sau đó, chọn phần giữ chỗ động từ danh sách các tùy chọn khả dụng và làm theo hướng dẫn để cấu hình phần giữ chỗ động đó với trường Odoo tương ứng mong muốn. Mỗi phần giữ chỗ động sẽ có cấu hình khác nhau.

Using dynamic placeholders in an email template.

Ghi chú

Each unique combination of Fields, Sub-models and Sub-fields creates a different dynamic placeholder. Imagine it as a combination to the field that is being created.

To search the available fields, simply type in the front-end name (on user-interface) of the field in the search. This will find a result from all of the available fields for the model that the email template is created for.

Cảnh báo

Customizing email templates are out of the scope of Odoo Support.

Rich text editor

A rich text editor toolbar can be accessed by highlighting text in the email template. This can be used to change the heading, font size/style, color, add a list type, or a link.

Rich text editor in the email template.

Resetting email templates

Should the email template not work because the code has been altered it can be reset to restore it back to the out-of-box default template. Simply click on the Reset Template button in the upper left-hand of the screen and the template will be reset.

Resetting the email template.

Default reply on email templates

Under the Email Configuration tab on an email template, there is a Reply To field. In this field, add email addresses to which replies are redirected when sending emails en masse using this template.

Mẹo

Add multiple email addresses by adding a comma , between the addresses or dynamic placeholders.

Reply-to field on template.

The Reply To field is only used for mass mailing (sending emails in bulk). Bulk emails can be sent in almost every Odoo application that has a list view option.

Để gửi email hàng loạt, trong chế độ xem danh sách, tích chọn các ô bên cạnh những bản ghi muốn gửi email, nhấp nút Tác vụ (biểu tượng ⚙️ (bánh răng)), và chọn tùy chọn email mong muốn từ menu thả xuống Tác vụ. Các tùy chọn email có thể khác nhau tùy theo chế độ xem danh sách và ứng dụng cụ thể.

Nếu có thể gửi email, một cửa sổ soạn thư sẽ bật lên, với các giá trị có thể được xác định và tùy chỉnh. Tùy chọn này sẽ khả dụng trong nút Tác vụ trên các trang cho phép gửi email hàng loạt. Ví dụ, trên trang Khách hàng của ứng dụng CRM. Tác vụ này diễn ra xuyên suốt toàn bộ cơ sở dữ liệu Odoo.

Email composer in mass mailing mode with reply-to highlighted.

Transactional emails and corresponding URLs

In Odoo, multiple events can trigger the sending of automated emails. These emails are known as transactional emails, and sometimes contain links redirecting to the Odoo database.

By default, links generated by the database use the dynamic web.base.url key defined in the system parameters. For more information about this, see system parameters.

If the Website application is not installed, the web.base.url key will always be the default parameter used to generate all the links.

Quan trọng

Khóa web.base.url chỉ có thể có một giá trị duy nhất. Điều này nghĩa là trong môi trường cơ sở dữ liệu có nhiều trang web hoặc nhiều công ty, ngay cả khi mỗi trang web có một tên miền riêng biệt, các liên kết được tạo ra để chia sẻ tài liệu (hoặc các liên kết trong email giao dịch) có thể vẫn giống nhau, bất kể trang web/công ty nào liên quan đến việc gửi email/tài liệu.

Example

Nếu Giá trị của tham số hệ thống web.base.url được đặt là https://www.mycompany.com và có hai công ty riêng biệt trong Odoo với các URL trang web khác nhau: https://www.mycompany2.comhttps://www.mycompany1.com, các liên kết được Odoo tạo để chia sẻ tài liệu hoặc gửi email giao dịch sẽ sử dụng miền: https://www.mycompany.com, bất kể công ty nào gửi tài liệu hoặc email.

Điều này không phải lúc nào cũng đúng, vì một số ứng dụng của Odoo (ví dụ như Thương mại điện tử) có liên kết được thiết lập trong cơ sở dữ liệu với ứng dụng Trang web. Trong trường hợp đó, nếu một miền cụ thể được chỉ định cho trang web, URL được tạo ra trong mẫu email sẽ sử dụng miền được xác định trên trang web tương ứng của công ty.

Example

When a customer makes a purchase on an Odoo eCommerce website, the order has an established link with that website. As a result, the links in the confirmation email sent to the customer use the domain name for that specific website.

Ghi chú

A document shared using the Documents application will always use the web.base.url key, as the document shared is not associated with any particular website. This means that the URL will always be the same (the web.base.url key value), no matter what company it's shared from. This is a known limitation.

For more information about how to configure domains, check out the domain name documentation.

Updating translations within email templates

In Odoo, email templates are automatically translated for all users in the database for all of the languages installed. Changing the translations shouldn't be necessary. However, if for a specific reason, some of the translations need to be changed, it can be done.

Cảnh báo

Like any modification in the code, if translation changes are not done correctly (for example, modifications leading to bad syntax), it can break the template, and as a result, the template will appear blank.

In order to edit translations, first enter developer mode. Then, on the email template, click on the Edit button, and then click on the language button, represented by the initials of the language currently being used (e.g. EN for English).

Edit the language of a template.

Ghi chú

If there aren't multiple languages installed and activated in the database, or if the user does not have administration access rights, the language button will not appear.

A pop-up window with the different languages installed on the database appears. From this pop-up, editing of translations is possible. When the desired changes have been made, click the Save button to save the changes.

Translation of the body of the Appointment Booked template.

Ghi chú

When editing the translations, the default language set in the database appears in bold.