Changeset 7400


Ignore:
Timestamp:
20 Dec 2011, 08:09:38 (13 years ago)
Author:
Henrik Bettermann
Message:

Use send_mail function also in sendMail method. browser.txt still fails.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
2 edited

Legend:

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

    r7383 r7400  
    5050  >>> browser.getControl(name='form.fullname').value = "Bob Tester"
    5151  >>> browser.getControl(name='form.email_from').value = "xx@yy.zz"
    52   >>> browser.getControl(name='form.body').value = "test message with umlaut ä"
     52  >>> browser.getControl(name='form.body').value = u'test message with umlaut ä'
    5353  >>> browser.getControl('Send').click()
    5454  >>> print browser.contents
  • main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py

    r7399 r7400  
    2929
    3030def 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    """
    3137
    3238    header_charset = 'ISO-8859-1'
     
    4450            body.encode(body_charset)
    4551        except UnicodeError:
    46             print "FAILED: ", body_charset, text
     52            print "FAILED: ", body_charset, body
    4753            pass
    4854        else:
     
    8288%s
    8389"""
    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)
    9797
    9898    def fullname(self,firstname,lastname,middlename=None):
     
    116116
    117117        Returns True or False to indicate successful operation.
    118 
    119         XXX: While this method is unicode-proof (i.e. it can handle
    120              non-plain-ASCII chars in names and messages) other
    121              methods inhere are not and will fail silently. Some
    122              reorganization of SMPT-related code is needed here.
    123118        """
    124119        username = applicant.applicant_id
Note: See TracChangeset for help on using the changeset viewer.