Files
odoo_source/addons/mail/data/mail_templates_mailgateway.xml
T
std-odoo 9c1cdd330e [IMP] mail: avoid email loops when Odoo reply automatically
Purpose
=======
In this commit, we will fix the loops that occur when you send an email
to an alias (to create a ticket e.g.). In that case Odoo can reply
"Your ticket has been created" and then the auto-replier of the user
can reply to this email and the loop occurs.

Specifications
==============
To solve this issues, we add 2 system parameters
- <mail.gateway.loop.minutes>, 120 minutes by default
- <mail.gateway.loop.threshold>, 20 by default

When an email is sent to an alias, we look on the last records created
<mail.gateway.loop.minutes> minutes ago. If we overcome the limit
<mail.gateway.loop.threshold> the email is ignored.

Alias creation detection
========================
To detect the number of records created by a specific email address we
use the `_primary_email` attribute set on the model.

Task-2294034

closes odoo/odoo#78597

Related: odoo/enterprise#21772
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-05-20 13:14:56 +02:00

34 lines
1.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="message_notification_limit_email">
<p>Dear Sender,</p>
<p>
The message below could not be accepted by the address <t t-esc="email"/> because you have
contacted it too many times in the last few minutes.
<br/>
Please try again later.
</p>
<p>Kind Regards</p>
</template>
<template id="mail_bounce_catchall">
<div>
<p>Hello <t t-esc="message['email_from']"/>,</p>
<p>The email sent to <t t-esc="message['to']"/> cannot be processed. This address
is used to collect replies and should not be used to directly contact <t t-esc="res_company.name"/>.</p>
<p>Please contact us instead using <a t-att-href="'mailto:%s' % res_company.email"><t t-esc="res_company.email"/></a></p>
<p>Regards,</p>
<p>The <t t-esc="res_company.name"/> team.</p>
</div>
<blockquote><t t-esc="message['body']"/></blockquote>
</template>
<!-- Mail bounce alias mail template -->
<template id="mail_bounce_alias_security">
<div><t t-out="body"/></div>
<blockquote><t t-out="message['body']"/></blockquote>
</template>
</data>
</odoo>