Changeset 7400 for main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py
- Timestamp:
- 20 Dec 2011, 08:09:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py
r7399 r7400 29 29 30 30 def send_mail(from_name,from_email,rcpt_name,rcpt_email,subject,body,config): 31 """ 32 XXX: While this method is unicode-proof (i.e. it can handle 33 non-plain-ASCII chars in names and messages) other 34 methods inhere are not and will fail silently. Some 35 reorganization of SMPT-related code is needed here. 36 """ 31 37 32 38 header_charset = 'ISO-8859-1' … … 44 50 body.encode(body_charset) 45 51 except UnicodeError: 46 print "FAILED: ", body_charset, text52 print "FAILED: ", body_charset, body 47 53 pass 48 54 else: … … 82 88 %s 83 89 """ 84 msg = MIMEText(text % (fullname,username,usertype,portal,body)) 85 msg['From'] = '%s <%s>' % (fullname,email_from) 86 msg['To'] = email_to 87 msg['Subject'] = subject 88 server = smtplib.SMTP(config.smtp_server) 89 if config.smtp_requires_login: 90 server.login(config.smtp_username,config.smtp_password) 91 try: 92 server.sendmail(email_from,email_to,msg.as_string()) 93 except: 94 return False 95 server.quit() 96 return True 90 from_name = fullname 91 from_email = email_from 92 rcpt_name = 'xyz' 93 rcpt_email = email_to 94 body = text % (fullname,username,usertype,portal,body) 95 return send_mail( 96 from_name,from_email,rcpt_name,rcpt_email,subject,body,config) 97 97 98 98 def fullname(self,firstname,lastname,middlename=None): … … 116 116 117 117 Returns True or False to indicate successful operation. 118 119 XXX: While this method is unicode-proof (i.e. it can handle120 non-plain-ASCII chars in names and messages) other121 methods inhere are not and will fail silently. Some122 reorganization of SMPT-related code is needed here.123 118 """ 124 119 username = applicant.applicant_id
Note: See TracChangeset for help on using the changeset viewer.