Я просматривал ответы на эти вопросы, но, к сожалению, не могу найти ответ, который мне подходит ... Вот мой код ... При отправке электронного письма через Python апостроф не работает правильно на основе ошибки кодирования. Чего мне не хватает
Все содержимое отправлено по электронной почте должным образом, но апостроф отображается следующим образом:
Я пробовал с разными настройками кодировки, но пока не могу найти решение. Любая помощь будет оценена.
#---------------------------------------------------------------------------------------------------------------------------
#HTML CONTENT
#---------------------------------------------------------------------------------------------------------------------------
text = """
"""
html = """
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<p style="border-bottom: 2px solid #00874E; width:100%; text-align:left; padding-top:10px; color:#3f3f3f"><font size="3"><b>SIGNIFICANT INSIDER TRANSACTIONS</b></font></p>
<table style="width:100%">
<tr>
<td style="font-size:11px; text-align: justify">"""+header_insiders+"""</td>
</tr>
<tr>
<td style="font-size:11px"><b>Dollar Value Buying (000's)</b></td>
</tr>
<tr>
<td style="font-size:11px; text-align: justify">"""+dollar_buying_combine+"""</td>
</tr>
<tr>
<td style="font-size:11px"><b>Dollar Value Selling (000's)</b></td>
</tr>
<tr>
<td style="font-size:11px; text-align: justify">"""+dollar_selling_combine+"""</td>
</tr>
</table>
<p style="border-bottom: 2px solid #00874E; width:100%; text-align:left; padding-top:10px; color:#3f3f3f"><font size="3"><b>PRESS HEADLINES</b></font></p>
<table style="width:100%">
<tr>
<td><b>Bloomberg</b></td>
</tr>
<tr>
<td>""" + bloomberg + """</td>
</tr>
<tr>
<td><b>The Globe & Mail</b></td>
</tr>
<tr>
<td>""" + globe + """</td>
</tr>
<tr>
<td><b>Reuters</b></td>
</tr>
<tr>
<td>""" + reuters + """</td>
</tr>
<tr>
<td><b>The Wall Street Journal</b></td>
</tr>
<tr>
<td>""" + WSJ + """</td>
</tr>
<tr>
<td><b>Financial Times</b></td>
</tr>
<tr>
<td>""" + FT + """</td>
</tr>
<tr>
<td><b>Financial Post</b></td>
</tr>
<tr>
<td>""" + FP + """</td>
</tr>
</table>
</body></html>
"""
#---------------------------------------------------------------------------------------------------------------------------
#SEND EMAIL
#---------------------------------------------------------------------------------------------------------------------------
message = MIMEMultipart(
"alternative", None, [MIMEText(text), MIMEText(html.encode('utf-8'), 'html','utf-8')])
message['Subject'] = "Morning Note"
message['From'] = me
message['To'] = you
server = smtplib.SMTP(server)
server.ehlo()
server.starttls()
server.login(me, password)
server.sendmail(me, you, message.as_string())
server.quit()