diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-07-23 18:33:28 +0200 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-07-23 18:33:28 +0200 |
| commit | ba0c939bb82fda52d7bef4ec5d492f018608b4ee (patch) | |
| tree | 22f99f7f0c4fab287b5402e85f69f3edf33ac46e /bin/tools/misc.py | |
| parent | 2eb6b8265b0030121046b258793368e16211744a (diff) | |
| parent | 19d0053be2fd225b4140ebe66dcb264a13a8f20a (diff) | |
merge
bzr revid: christophe@tinyerp.com-20080723163328-wyr58fg7gntstz1v
Diffstat (limited to 'bin/tools/misc.py')
| -rw-r--r-- | bin/tools/misc.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 3afe99ed2e2..4d8966ffc87 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -335,7 +335,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non #---------------------------------------------------------- # Emails #---------------------------------------------------------- -def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, attach=None, tinycrm=False): +def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False): """Send an email.""" if not email_cc: email_cc=[] @@ -375,6 +375,14 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_ msg.attach(part) try: s = smtplib.SMTP() + + if debug: + s.debuglevel = 5 + if ssl: + s.ehlo() + s.starttls() + s.ehlo() + s.connect(config['smtp_server']) if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) @@ -383,6 +391,8 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_ except Exception, e: import logging logging.getLogger().error(str(e)) + return False + return True #---------------------------------------------------------- |
