Files
app-odoo/app_common/models/mail_mail.py
2025-02-10 04:11:56 +08:00

24 lines
925 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import logging
_logger = logging.getLogger(__name__)
class MailMail(models.Model):
_inherit = "mail.mail"
def _send(self, auto_commit=False, raise_exception=False, smtp_session=None):
for m in self:
email_to = m.email_to
# 忽略掉无效email避免被ban
if email_to:
if email_to.find('no-reply@odooai.cn') != -1 or email_to.find('postmaster-odoo@odooai.cn') != -1:
pass
elif email_to.find('example.com') != -1 or email_to.find('@sunpop.cn') != -1 or email_to.find('@odooapp.cn') != -1:
_logger.warning(_("=================Email to ignore: %s") % email_to)
self = self - m
if not self:
return True
return super(MailMail, self)._send(auto_commit, raise_exception, smtp_session)