From 5d729481dee62b33ded4108bdd896277ebdba3af Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Thu, 20 Dec 2012 15:11:51 +0100 Subject: [PATCH] [IMP] Show alert when sending a mail to reset password (or failure) bzr revid: vta@openerp.com-20121220141151-z3hd9i95eydd6l1h --- addons/auth_signup/res_users.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index f50db72d398..6e800cfbe86 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -245,11 +245,17 @@ class res_users(osv.Model): # send email to users with their signup url template = self.pool.get('ir.model.data').get_object(cr, uid, 'auth_signup', 'reset_password_email') + mail_obj = self.pool.get('mail.mail') assert template._name == 'email.template' for user in self.browse(cr, uid, ids, context): if not user.email: raise osv.except_osv(_("Cannot send email: user has no email address."), user.name) - self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context) + mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context) + mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context) + if mail_state and mail_state == 'exception': + raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name) + else: + raise osv.except_osv(_("Mail sent to user:"), user.name) return True