How to Force a Single "From" Email for Odoo 17 Modules

May 1, 2024 by
How to Force a Single "From" Email for Odoo 17 Modules
Alixsander Haj Saw
| No comments yet

Introduction

This guide covers how to force Odoo to use a specific "from" email for specific templates or for all modules, this is beneficial when you want to set a static "from" email instead of it dynamically changing as it does in some modules. 

For example in the Sales module when sending a Quotation, Odoo will send it using the sales persons email, if that sales persons email is not configured in the Outgoing Mail Servers, Odoo will fail to send the email.

To follow this guide you must have an Outgoing Mail Server configured, you can follow the following guide to create an Outgoing Mail Server on Odoo using a Gmail account:

Configuring Gmail SMTP with Odoo


Prerequisites

Make sure Outgoing Mail Servers are configured and working.


Set a "from" email for all Odoo modules

Following the below steps would configured a single "from" email for all Odoo modules. Odoo has a specific parameter that enforces the use of a specified email for all outgoing emails, here are the steps:

  1. Activate developer mode by going to Settings > General Settings > Developer Tools > Activate the developer mode.
  2. On the same General Settings page go to Technical (top menu) > Parameters > System Parameters.
  3. Search for mail.force.smtp.from, if it doesn't exist then create one, and set its value as the email you want to enforce and save it.


Set a "from" email for a specific function

To set an email for a specific function we'll need to modify the email template associated with it. I'll be using Sales: Send Quotation template in this example.

  1. Activate developer mode by going to Settings > General Settings > Developer Tools > Activate the developer mode.
  2. On the same General Settings page for to Technical (top menu) > Email > Email Templates.
  3. Search for the template you want to modify, in my case its the Sales: Send Quotation template, click on it.
  4. Click on the Email Configuration tab, here you will find the From field, add the email you want this specific template to use and save.


Sign in to leave a comment