Changeset 7358 for main/waeup.sirp/trunk/src/waeup/sirp/utils
- Timestamp:
- 16 Dec 2011, 07:13:28 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/utils
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py
r7321 r7358 480 480 account = authenticator.getAccount(principal_id) 481 481 return account 482 483 def send_mail(fullname,username,usertype,portal,body,email_from,email_to,subject):484 """Send an email with data provided by forms.485 """486 config = grok.getSite()['configuration']487 text = """Fullname: %s488 User Id: %s489 User Type: %s490 Portal: %s491 492 %s493 """494 msg = MIMEText(text % (fullname,username,usertype,portal,body))495 msg['From'] = '%s <%s>' % (fullname,email_from)496 msg['To'] = email_to497 msg['Subject'] = subject498 server = smtplib.SMTP(config.smtp_server)499 if config.smtp_requires_login:500 server.login(config.smtp_username,config.smtp_password)501 try:502 server.sendmail(email_from,email_to,msg.as_string())503 except:504 return False505 server.quit()506 return True
Note: See TracChangeset for help on using the changeset viewer.