forked from itpp-labs/misc-addons
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cf03609
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import mail_fix_553 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name" : "Fix error 553", | ||
"version" : "0.3", | ||
"author" : "Ivan Yelizariev", | ||
"category" : "Mail", | ||
"website" : "https://it-projects.info", | ||
"description": """Update 'Reply-to' field to catchall value in order to fix problem like that: | ||
2014-01-18 06:25:56,532 6789 INFO trunk openerp.addons.mail.mail_thread: Routing mail from <[email protected]> to [email protected] with Message-Id <[email protected]>: direct alias match: (u'res.users', 1, {}, 1, browse_record(mail.alias, 1)) | ||
2014-01-18 06:25:57,212 6789 ERROR trunk openerp.addons.base.ir.ir_mail_server: Mail delivery failed via SMTP server 'smtp.yandex.ru'. | ||
SMTPSenderRefused: 553 | ||
5.7.1 Sender address rejected: not owned by auth user. | ||
[email protected] | ||
Traceback (most recent call last): | ||
File "/mnt/files/src/openerp-server/server/openerp/addons/base/ir/ir_mail_server.py", line 465, in send_email | ||
smtp.sendmail(smtp_from, smtp_to_list, message.as_string()) | ||
File "/usr/lib/python2.7/smtplib.py", line 722, in sendmail | ||
raise SMTPSenderRefused(code, resp, from_addr) | ||
SMTPSenderRefused: (553, '5.7.1 Sender address rejected: not owned by auth user.', '[email protected]') | ||
2014-01-18 06:25:57,216 6789 ERROR trunk openerp.addons.mail.mail_mail: failed sending mail.mail 2 | ||
Traceback (most recent call last): | ||
File "/mnt/files/src/openerp-server/addons/mail/mail_mail.py", line 284, in send | ||
context=context) | ||
File "/mnt/files/src/openerp-server/server/openerp/addons/base/ir/ir_mail_server.py", line 478, in send_email | ||
raise MailDeliveryException(_("Mail Delivery Failed"), msg) | ||
MailDeliveryException: (u'Mail Delivery Failed', u"Mail delivery failed via SMTP server 'smtp.yandex.ru'.\nSMTPSenderRefused: 553\n5.7.1 Sender address rejected: not owned by auth user.\n[email protected]") | ||
2014-01-18 06:25:57,223 6789 INFO trunk openerp.addons.fetchmail.fetchmail: fetched/processed 1 email(s) on imap server yandex | ||
""", | ||
"depends" : ["base", "mail"], | ||
#"init_xml" : [], | ||
#"update_xml" : [], | ||
#"active": True, | ||
"installable": True | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import re | ||
from openerp.osv import osv, fields | ||
from openerp import SUPERUSER_ID | ||
|
||
class mail_mail(osv.Model): | ||
_inherit = "mail.mail" | ||
def send(self, cr, uid, ids, context=None, **kwargs): | ||
catchall_alias = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.alias", context=context) | ||
catchall_domain = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.domain", context=context) | ||
|
||
fix_ids = [] | ||
for mail in self.browse(cr, SUPERUSER_ID, ids, context=context): | ||
if re.search('@%s>?\s*$'%catchall_domain, mail.email_from) is None: | ||
print 'fix:', mail.email_from | ||
fix_ids.append(mail.id) | ||
|
||
email_from = '%s@%s' % (catchall_alias, catchall_domain) | ||
print 'new email', email_from | ||
|
||
if fix_ids: | ||
self.write(cr, uid, fix_ids, {'email_from': email_from}, context=context) | ||
|
||
return super(mail_mail, self).send(cr, uid, ids, context=context, **kwargs) |