python - python格式文件内容发送小瓶html邮件
问题描述
我正在使用 python 使用这种方法将文件的内容发送到电子邮件:
f = open(file,"r")
contents = f.read()
在我放入的html代码中:
<head></head>
<body>
<h1>Alerta</h1>
<p>{contents}</p>
</body>
</html>
""".format(contents=contents)
该文件如下所示:
phrase 1
phrase 2
phrase 3
phrase 4
但在我收到的电子邮件中:
phrase 1 phrase 2 phrase 3 phrase 4
有没有办法以与原始文件类似的方式获取电子邮件?
解决方案
推荐阅读
- bootstrap-4 - 在移动视图中将导航项更改为手风琴
- javascript - 节点 mqtt 服务器不传播发布
- vuejs2 - 在 vue.js 客户端合并来自不同 graphql 解析器的数据以进行简单输出
- c# - 比较 C# 中的两条路径。何时使用区分大小写?
- r - as_datetime() 错误:所有格式都无法解析
- r - 三组散点图中的平均值±SE
- javascript - 等到所有 Observables 完成
- c++ - 如何在没有中间限制的情况下定义与 STL 兼容的输入迭代器?
- python - “ValuesViewHDF5”对象不可下标
- apache-kafka - 如何将单消息转换与 Kafka Connect JDBC 源连接器和多个表一起使用?