outlook will nicht so, wie ich will!
Konkret möchte ich eine MultipartMail mit Text und HTML-Version verschicken. Dabei sollte der Textteil mit Ascii und Monotype relativ hübsche Kästchen darstellen können..
Leider stellt Outlook als Textteil scheinbar nur eine gefilterte Version des HTML-Teils dar...
http://www.kk.net/mail/index_html
Weiß jemand, ob es einen Trick gibt Outlook dazu zu bringen, wirklich den Textteil darzustellen? Oder ist etwas an der Mimetypeverschachtelung falsch?
Vielleicht hilft das auch noch anderen beim Erzeugen von Emails:
Code: Alles auswählen
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.base64MIME import header_encode
_s = ', ' # seperator
_charset = 'iso-8859-1'
_charset_ascii = 'us-ascii'
me = 'info@bar.org<info@bar.org>'
you = ['foo <foo@bar.org>']
sub = 'just another test äüöÄÜÖß 2'
htm = """
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h3>Testmail</h3><br>
<table style="border:1px solid blue;" width="200">
<tr><td align="left"><b>fett</b></td></tr>
<tr><td align="middle"><i>kursiv</i></td></tr>
<tr><td align="right"><u>unterstrichen</u></td></tr>
</table><br>
<br>
äüöÄÜÖß<br>
Ende.
</body>
</html>
"""
txt = """Testmail
+--------------------------+
| fett |
+--------------------------+
| kursiv |
+--------------------------+
| unterstrichen |
+--------------------------+
äüöÄÜÖß
Ende.
"""
msgAltr = MIMEMultipart('alternative')
msgRoot = MIMEMultipart('related')
msgRoot['Subject'] = header_encode(sub)
msgRoot['From'] = me
msgRoot['To'] = _s.join(you)
msgRoot.preamble = 'This is a multi-part message in MIME format.'
# Create a text/plain message
msgText = MIMEText(txt, 'plain', _charset)
msgAltr.attach(msgText)
# Create a text/html message
msgHtml = MIMEText(htm, 'html', _charset)
msgAltr.attach(msgHtml)
msgRoot.attach(msgAltr)
s = smtplib.SMTP()
s.connect('mailrelay')
s.sendmail(me, you, msgRoot.as_string())
s.close()
Gruß
Jens