I spent the whole afternoon trying to send an HTML formatted email
with web2py.
while I cannote use smtplib directly, cause it seems not to work, and
I think this should be "normal" in the framework.
however in the current release (Version 1.65.0 (2009-07-01 12:16:25))
it is not possible to alter the content-type, or any other header for
the email using the gluon.tools.Mail class.
this happens because anu message that is passed to the mail=Mail()
object is attached to this string before beeing sent:


msg = '''From: %s\r
To: %s\r
Subject: %s\r
\r
%s'''\


and the double newlines close the headers.

so it would be very useful to also set at least something link this:

    def send(
        self,
        to,
        subject='None',
        message='None',
        headers='\r\n'
        ):


                msg = '''From: %s\r
To: %s\r
Subject: %s\r
\r
%s'''\
                     % (self.settings.sender, ', '.join(to),
subject,headers,
                        message)


so that it will be possible to pass directly some header strings or
pass an empty string as headers, and put them in the message.
this way they can be correctly recognized.

hope this helps
cheers



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to