summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPooja Zankhariya (OpenERP) <pza@tinyerp.com>2013-10-30 18:10:55 +0500
committerPooja Zankhariya (OpenERP) <pza@tinyerp.com>2013-10-30 18:10:55 +0500
commita59de2a106ff4e835b42b917ecbbb24f67c8eefb (patch)
tree896b08575cd633c0f8163f0245d4e90698fbdfc0
parentc4dd49d31776a0e3f083a16f883cea76d569ae27 (diff)
[IMP]Added warning when user clicks on send button and server is not configured
bzr revid: pza@tinyerp.com-20131030131055-ljewgj0zz86hxzli
-rw-r--r--addons/mail/mail_mail.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py
index 01d48c73d6a..fa04e249b90 100644
--- a/addons/mail/mail_mail.py
+++ b/addons/mail/mail_mail.py
@@ -242,6 +242,14 @@ class mail_mail(osv.Model):
:return: True
"""
ir_mail_server = self.pool.get('ir.mail_server')
+ mail_connection = ir_mail_server.search(cr, uid, [], order='sequence', limit=1)
+ smtp_server = ir_mail_server.browse(cr, uid, mail_connection, context=context)[0]
+ try:
+ connection = ir_mail_server.connect(smtp_server.smtp_host, smtp_server.smtp_port, user=smtp_server.smtp_user,
+ password=smtp_server.smtp_pass, encryption=smtp_server.smtp_encryption,
+ smtp_debug=smtp_server.smtp_debug)
+ except:
+ raise self.pool.get('res.config.settings').get_config_warning(cr, _("Cannot send email: no outgoing email server configured.\nYou can configure it under %(menu:base.menu_mail_servers)s."), context)
for mail in self.browse(cr, SUPERUSER_ID, ids, context=context):
try:
# handle attachments