This commit removes the strange selection box based on a magic flag and
some strange methods returning a string. Instead just allow to send mass
mailing on all models inheriting from mail.thread using the is mail
thread flag.
Various addons are updated to remove the _mail_mass_mailing class
attribute used to determine mass mailing capability.
We consider people could send a mass mailing on every model inheriting
from mail.thread. It makes no sense to limit it to a given set of addons.
When you send a mass mailing to muiltiple partner, if some of them have
no email adresse, it can lead to errors because of the variable 'recips'
is not set if the first occurence in the 'for loop' has no email.
To fix this, we always set the variable 'recips' by replacing the 'elif'
close by a 'else' one
introduced in rev: https://github.com/odoo/odoo/commit/65ed4553a50fdbefc986b7d21f87a81c42b743c7
Before this commit, the filtering brought by commit ca989b6 did not work when
no email_to was present. Which is the case for mass-mailings based on
res.partner records.
OPW 728321
Closes#16745
The mass-mailing App suffered from severe issues due to its inability
to detect and handle duplicates "at the email level", and the absence
of any global blacklist system, leading to lack of user trust.
Mailing-lists typically include multiple records with the same email,
and it is critical to avoid sending them the same email several times.
A related problem is the unsubscription of an email that is present
in other records (duplicates). Opting out the first email should
automatically blacklist it for other records as well.
Ideally we should have a global blacklist table in order to
share the unsubscription requests globally across models (Leads,
Partners, Mailing-list contacts). It would also allow importing
it from other blacklist systems. (TODO for master)
This commit introduces a partial solution, made of several
small changes:
- In mail.mail: double-check that an outgoing email has the
correct status (`outgoing`) before sending it. This allows
adding emails in the queue and cancelling them before they
actually get sent.
- In crm.lead: force predictable recipients for mass-mailing,
by always using the email of the lead rather than the email
of the linked partner when there is one. This simplifies the
computation of the blacklist and seen list. Other areas in
the codebase already assume as much.
- In mass.mailing:
+ Before sending out a mailing-list batch, compute the
blacklist (all opted-out emails) and the seen_list
(emails who previously received this mail) to make
sure we only ever target valid recipients.
+ While delivering the mass-mailing, any email targeting
an address that is in the blacklist or "seen list" is
canceled before being sent. The corresponding statistics
entry is considered "not delivered".
Also updates the "seen list" continuously.
+ When a mass-mail belongs to a campaign with the
"unique AB/B testing" flag, the "seen list" is
common to the whole campaign, as an extra safety.
+ Auto-delete mass-mailing test messages sent with the
test wizard, to avoid polluting the mail_mail table
Note: this fix uses a simple regex for efficiently extracting
the blacklist in pure SQL from different models, and doing so,
assumes that each record only holds a single email
(no comma-separated adresses). This should be sufficient for
most cases. The regex:
([^ ,;<@]+@[^> ,;]+)
1. The merge of the "email_template" module into the "mail" module.
2. The send action of the mass mailing has been moved from the frontend to a cron, because it was too slow to send over 10,000 mails (the user's browser was blocked for 15 - 20 minutes). Mass mailings have now their own process in the kanban view.
3. Mails sent from the mail form are sent immediatly instead of from the mail queue (for instance, when you go to sales > customers > list view > select 2 -3 customers > More > Partner Mass Mailing).
4. Users have now the choice from which mailing list they want to unsubscribe when they click on the unsubscribe link at the bottom of the mail.
5. Mass mailings inherit from their campaign UTMs and mass mailing campaigns are linked to an UTM campaign.
6. Many little improvements
* [FIX] rename wrong mailing_type field and add missing fields when creating a mass mailing from the composer
* [FIX] coerce tooltip to an unicode string to avoid a json crash when locale produces a non unicode string for strftime(%B)
* [FIX] repair wrong sql statement computing statistics
- fixed keeping the original message for routing, only when choosing to reply in the
original thread (notification=True)
- auto delete sent emails explicitely
- mail_thread: routing: fixed replies always choosen even when replying to emails
with a specified reply_to (using ref_match in the algorithm)
- mail_thread: routing: instead of exclusive routing heuristics, use each case
as a fallback of the previous.
- now body_html is a right field on mass_mailing, editable using the website
- email_designer controller / template now works on everything that has a body
receiving its model and res_id as post parameters; it does not work only on
email tempaltes anymore
- cleaning of the mass mailing form view: reply_to managment option (either
replied go into the document, either there is a specified reply_to; it is implemented
using boolean fields instead of a selection because all options are not available
for all models ... models like contact or partner do not have a chatter or
shoudl be be used for a chatter-like use)
- send to all now instantiates a mail.compose.message; the mass mailign processing
is delegated to the wizard itself.
bzr revid: tde@openerp.com-20140407170346-hpklabi513xskd07
- campaign appear only when having the group activated
- now choosing the mailing name, that create the mailing list + campaign
- currently limited to the valid models
bzr revid: tde@openerp.com-20140317165649-321f0wxatvj4pz5w
- added fields on mail.mail.statistics form view to have all data;
- added comments;
- cleaned get_mail_values override now that statistics are created using o2m command
bzr revid: tde@openerp.com-20130917103555-jwhgl8y49g505ugz
mail_mail now have a statistics_ids field, allowing to create statistics when creating a mail.mail.
This is done in the mail composer, using classic o2m command. Mail_mail create is overrided to ipdate
the statistics value (message_id) that is computed directly in the create and not accessible
in the values dict.
Added model and res_id on stat model, to allow message_bounce update, without havign to rely
on the mail.mail existence.
bzr revid: tde@openerp.com-20130917094218-7jz5mnldogzhlioh
- fixed forgottent import of mail_thread in mass_mailing, to enable bounce and replied tracking
- fixed replied computation in message_route_process, adding the original email in parameters
- fixed form view of campaign, to add edit and dlete now that clicking on it redirects to the waves
- added track field on mail_mail, to avoid creating too mush entries in mail.mail.statistics
- fixed mass_mailign controller
bzr revid: tde@openerp.com-20130916114706-b9zyhp0ha6mr9fzg
Only remaining field is mass_mailing_campaign_id; if set, a new segment is automatically created
and its id is given to the created mail.mail.statistics using default value in context
bzr revid: tde@openerp.com-20130913132234-66vl19w54znky2rc
Mail statistics are now stored onto a separated object (mail.mail.statistics), allowing to
handle emails separately from statistics (among other removing mail.mail entries while keeping
statistics).
Everything linnked to opened/replied/bounce is not managed by mass_mailing, removed added code
in mail module.
bzr revid: tde@openerp.com-20130913115408-322cyjipdg680as6
It can be called directly from within the campaign form view, using a button.
It allows to easily create new segments and launch the composer.
bzr revid: tde@openerp.com-20130912100909-ofalececxn64a389
simple mass mailing campaign model, linked to emails, compute some statistics
mail.compose.message updated to the mass mailing campaigns in mass mail mode
bzr revid: tde@openerp.com-20130807130334-nwd34fgsz4lc6lt1