Changeset 2715

Show
Ignore:
Timestamp:
10/26/07 05:21:29 (1 year ago)
Author:
coling
Message:

Change round the ordering of the mime parts in the email. They were incorrect in the example I copied.... I blame him\!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • clientsplugin/0.11/cron/send-client-email

    r2713 r2715  
    9494     
    9595    # Create the root message and fill in the from, to, and subject headers 
    96     msg_root = MIMEMultipart('related') 
     96    msg_root = MIMEMultipart('alternative') 
    9797    msg_root['To'] = str(', ').join(addresses) 
    9898     
     
    107107    msg_root.preamble = 'This is a multi-part message in MIME format.' 
    108108     
    109     # Encapsulate the plain and HTML versions of the message body in an 
    110     # 'alternative' part, so message agents can decide which they want to display. 
    111     msg_alternative = MIMEMultipart('alternative') 
    112     msg_root.attach(msg_alternative) 
    113      
    114      
    115109    view = 'plain' 
    116110    result = formatter.applyStylesheet(info, {'view': '"%s"' % view }) 
    117111    msg_text = MIMEText(formatter.saveResultToString(result), view, self.encoding) 
    118     msg_alternative.attach(msg_text) 
     112    msg_root.attach(msg_text) 
    119113    result.freeDoc() 
     114     
     115    msg_related = MIMEMultipart('related') 
     116    msg_root.attach(msg_related) 
    120117     
    121118    view = 'html' 
    122119    result = formatter.applyStylesheet(info, {'view': '"%s"' % view }) 
    123120    msg_text = MIMEText(formatter.saveResultToString(result), view, self.encoding) 
    124     msg_alternative.attach(msg_text) 
     121    msg_related.attach(msg_text) 
    125122    result.freeDoc() 
    126123     
     
    141138        fp.close() 
    142139        msg_img.add_header('Content-ID', '<%s>' % img.prop('id')) 
    143         msg_root.attach(msg_img) 
     140        msg_related.attach(msg_img) 
    144141    result.freeDoc() 
    145142