Ignore:
Timestamp:
27 Nov 2011, 06:50:43 (13 years ago)
Author:
Henrik Bettermann
Message:

Now we have a configuration object and can provide ContactAdminForm? with proper credentials for a smtp server.

Add Email address to IAccount objects so that 'From' fields in emails, sent by users, can be automatically filled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7214 r7221  
    313313        name = data['name']
    314314        title = data['title']
     315        email = data['email']
    315316        description = data['description']
    316317        #password = data['password']
     
    326327                return
    327328        try:
    328             self.context.addUser(name, password, title=title,
     329            self.context.addUser(name, password, title=title, email=email,
    329330                                 description=description, roles=roles)
    330331        except KeyError:
     
    506507        msg['From'] = '%s <%s>' % (fullname,email)
    507508
    508         # These parameters should be part of the portal configuration.
    509         msg['To'] = 'contact@waeup.org'
    510         msg['Subject'] = 'WAeUP Contact'
    511         #server = smtplib.SMTP('smtp_server')
    512         # Also connection details (username, passwords, host, port,
    513         # etc.) should be settable somewhere.
    514         # server.login('user_name','secret_password')
    515         server = smtplib.SMTP('localhost')
    516         server.sendmail(email,'contact@waeup.org',msg.as_string())
     509        config = grok.getSite()['configuration']
     510        msg['To'] = config.email_admin
     511        msg['Subject'] = config.email_subject
     512        server = smtplib.SMTP(config.smtp_server)
     513        if config.smtp_requires_login:
     514            server.login(config.smtp_username,config.smtp_password)
     515        server.sendmail(email,config.email_admin,msg.as_string())
    517516
    518517        server.quit()
Note: See TracChangeset for help on using the changeset viewer.