Smart Email Routing
by Space-O Technology https://www.spaceotechnologies.com/services/odoo-development/$ 52.60
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
Discuss (mail)
|
Lines of code | 279 |
Technical Name |
smart-email-routing |
License | OPL-1 |
Website | https://www.spaceotechnologies.com/services/odoo-development/ |
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
Discuss (mail)
|
Lines of code | 279 |
Technical Name |
smart-email-routing |
License | OPL-1 |
Website | https://www.spaceotechnologies.com/services/odoo-development/ |
Smart Email Routing
This feature allows you to set up outgoing mail servers dynamically based on any selection field of any record in Odoo. For instance, if a record from a model (like Lead/Opportunity) contains a specific value in a selection field (e.g., Source), Odoo will automatically use the mail server associated with that value to send emails. This can be applied to any model and any selection field, making it fully dynamic.
Save 80%
customization time
Multi user &
company support
No technical
knowledge required
Multi
language support

Features
Smart Email Routing
Selection Field Trigger
Model Flexibility
Benefits of Smart Email Routing in Odoo
- Dynamic Email Routing: Automatically route emails through different mail servers based on the value of a selection field (such as "Source" or "Customer").
- Multiple Mail Server Configuration: Set up different mail servers for different models and selection fields, offering granular control over which server handles specific emails.
- Seamless Email Management Across Models: Extend the dynamic configuration to any model in Odoo (Sales Orders, Invoices, etc.), ensuring consistent email delivery across the platform.
- Customizable Email Templates Linked to Servers: Set up email templates to be linked with specific outgoing mail servers for even more customization and control over how emails are sent.
- Improved Communication Efficiency: With automatic mail server selection, users save time, and errors from selecting incorrect mail servers are minimized.
- Flexible and Scalable Solution: This feature can scale with your business as you add more mail servers and apply them to different models and fields in Odoo.
- Security and Authentication Options: Support for different authentication methods (such as OAuth for Gmail or SSL/TLS encryption) ensures that your email communication complies with security best practices.



Example Use Case
Consider the following scenario
- Model: Lead/Opportunity
- Field: Source (Lead/Opportunity)
- Values: Facebook, Glassdoor
you set up a mail server for Facebook and another one for Glassdoor. If a lead's source is marked as Facebook, the emails will be sent via the Facebook outgoing mail server. If the source is Glassdoor, the emails will be sent through the Glassdoor server.
This can be applied to any selection field across any model in Odoo, making it an extremely powerful and dynamic feature.
Troubleshooting
If emails are not sent as expected
- Verify that the correct selection field values are assigned to the record.
- Ensure the outgoing mail server configurations are correct and the test connection succeeds.
- Check if the record model and field are properly selected in the outgoing mail server setup.
Advanced Configuration (Optional)
You can further extend this feature by
- Setting priority levels for mail servers, so if multiple conditions match, Odoo selects the higher priority mail server.
- Configuring email templates linked to specific outgoing mail servers for further customization.
Prerequisites
Ensure that you
- Have administrative access to your Odoo instance.
- Have already set up one or more outgoing mail servers.
Step-by-Step Configuration
➤ Step 1: Create or Edit Outgoing Mail Servers
1. First Go to Settings > Technical > Outgoing Mail Servers.

2. Click New to create a new mail server configuration or select an existing one to edit. Settings > Technical > Outgoing Mail Servers.
3. Fill in the essential information:
- Name: Provide a unique name for the mail server (e.g., "Facebook Mail Server").
- From Filtering: Specify the email address that should be used to send emails (e.g., admin@example.com).

➤ Step 2: Set the Dynamic Model and Field
1. Model: Choose the model in which the email sending behavior is applied (e.g., Lead/Opportunity, Sale Order, etc.). This ensures the mail server is linked to the records of that model.
2. Field: Select any selection field from that model. For example:
- Source (Lead/Opportunity) in the Lead/Opportunity model.
- Customer (Partner) in the Sale Order model.

➤ Step 3: Define Field Values
1. Under Values, define the specific values from the selected selection field. For example, if you selected the Source field, you could define values such as "Facebook," "Glassdoor," or any other sources available in the field's dropdown.
2. These values will serve as triggers. If a record has one of these values, Odoo will use this mail server to send the email.

➤ Step 4: Configure Authentication and Encryption
Username and password: Standard SMTP authentication.
- Name: Provide a unique name for the mail server (e.g., "Facebook Mail Server").
- SSL Certificate: Use an SSL certificate if required by your mail server.
- Command Line Interface: For advanced users who want to use a CLI-based authentication.
- Gmail OAuth Authentication: For Gmail servers using OAuth.
2. Choose the Connection Encryption (None, TLS, or SSL/TLS) depending on your server requirements.
3. Enter the Username and Password for the outgoing mail server.
4. Click Save to store the configuration.

➤ Step 5: Test the Connection
Once the outgoing mail server is set up, click on Test Connection to verify that the mail server can send emails successfully.
➤ Step 6: Apply to Other Models and Fields (Optional)
If you want to set up additional mail servers for other models or selection fields, repeat steps 1-5. This flexibility allows you to configure multiple servers for different models or even multiple servers for different values within the same field.
Frequently Asked Questions
The Dynamic Mail Server feature allows you to configure outgoing mail servers based on any selection field of any model in Odoo. This means that you can automatically route emails through different mail servers depending on the values of specific fields, such as lead source, customer, or any other dynamic criteria.
You can use this feature with any model in Odoo (e.g., Leads/Opportunities, Sales Orders, Invoices, etc.). Additionally, you can select any selection field within those models (e.g., Source, Customer, Vendor, etc.).
- Go to Settings > Technical > Outgoing Mail Servers.
- Create a new mail server configuration.
- Select the model and the selection field you want to use.
- Define the specific values of that field (e.g., "Facebook," "Glassdoor") for which the mail server should be applied.
- Configure the authentication and test the connection.
If a record doesn't match any defined mail server configuration, Odoo will use the default outgoing mail server for sending emails. Make sure to configure a default server for cases where no specific conditions are met.
Yes, you can configure multiple mail servers for the same model. For example, you could have one mail server for leads sourced from Facebook and another for leads from Glassdoor. Emails will be routed based on the values in the selection field.
Yes, you can set a Priority level for each mail server. If multiple conditions apply to a record, Odoo will use the mail server with the highest priority (lowest number). For instance, a mail server with priority 1 will be selected over a server with priority 10.
You can use this feature with any model in Odoo (e.g., Leads/Opportunities, Sales Orders, Invoices, etc.). Additionally, you can select any selection field within those models (e.g., Source, Customer, Vendor, etc.).
- Go to Settings > Technical > Outgoing Mail Servers.
- Create a new mail server configuration.
- Select the model and the selection field you want to use.
- Define the specific values of that field (e.g., "Facebook," "Glassdoor") for which the mail server should be applied.
- Configure the authentication and test the connection.
Once you’ve configured the mail server, click the Test Connection button in the Outgoing Mail Server settings. This will verify whether your settings are correct and if the mail server can send emails successfully.
Yes, you can configure email templates to work with the outgoing mail servers. When sending an email from a record, Odoo will automatically use the configured server based on the field values, and you can use email templates to further customize the content of the emails.
If emails are not being sent from the correct mail server, check the following:
- Ensure the model, field, and values are correctly selected in the mail server configuration.
- Verify that the mail server connection was successfully tested.
- Check if the field values in the record match the values defined in the outgoing mail server configuration.
No, there is no limit. You can configure as many outgoing mail servers as needed, for various models, fields, and values.
Yes, you can always update the field values in the record or edit the outgoing mail server configuration to change the routing of emails for that record.
No, this feature only affects outgoing emails. Incoming emails are handled separately through Odoo's inbound mail server settings.
By using this feature, you can route emails from the appropriate mail server based on record-specific information, ensuring that customers receive communications from the correct email address or domain (e.g., leads from Facebook will receive emails from a Facebook-specific email address).
Need Any Help ?
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module