python - 使用 Python 发送 Outlook 电子邮件时如何编写消息?
问题描述
我想使用 Python 在 Outlook 中编写消息:
大家好,
请帮助跟进以下机会:
[插入 html 表格]最好的, XXX
我已经尝试过,但格式看起来不对,例如“请帮助跟进以下机会”这句话没有出现在单独的行上
def Emailer(text, subject, recipient):
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.Subject = subject
mail.HtmlBody = text
mail.Display(True)
table = dummy.to_html()
Emailer('Hi everyone, \n\nPlease help follow up the following opportunities:'+table+'Best,\nXXX','PSE','XXX@gmail.com')
解决方案
原来我需要使用 html 语法:
Emailer('Hi everyone, <br>Please help follow up the following opportunities:'+table+'Best,<br>XXX','PSE','XXX@gmail.com')
推荐阅读
- javascript - 如何让这个 JavaScript 片段发送一封电子邮件,其中正文是先前声明的变量?
- python - 如何在一个图中调整不同 y 轴的刻度以具有相同的高
- encoding - 在遗传算法中编码为位串有何帮助?
- swift - 如何使用 NSSet 属性和任意集合过滤掉核心数据对象?
- buffer - 保存有关丢弃 LTTng 日志的信息
- angular - 材质选项卡按钮覆盖模式
- java - 在java中将整数转换为预期的日期值
- python - 水平定向图像中的对象
- mysql - 是否可以创建特定属性必须以数字结尾的 DDL 表?
- excel - 如何根据另一列单元格中的条目更新列中的单元格?