python邮件处理(smtplib与email模块)、mql4中的邮件处理

2024-01-04 13:58

本文主要是介绍python邮件处理(smtplib与email模块)、mql4中的邮件处理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

python:

Python SMTP发送邮件 | 菜鸟教程  http://www.runoob.com/python/python-email.html

smtplib与email模块(实现邮件的发送)https://www.cnblogs.com/freely/p/6859117.html

smtplib — SMTP protocol client — Python 3.7.1 documentation  https://docs.python.org/3.7/library/smtplib.html

python3发送邮件(有附件) - sammy1989 - 博客园  https://www.cnblogs.com/sammy1989/p/6137928.html

python发送邮件脚本(支持多个附件,中文) - RangeYan - CSDN博客  https://blog.csdn.net/yanshu2012/article/details/50396068

python邮件处理包email发邮件,邮件名称含有中文,但在接收邮箱中显示的文件名称及后缀却完全不一样。

att1["Content-Disposition"] = 'attachment; filename= "销售明细.xls"'
#邮件附件名称含有中文,收到邮件就是错误的名称,打不开。
att1["Content-Disposition"] = 'attachment; filename= "1.xls"'
#邮件名称换成英或或数字的,就正常发送邮件

email — An email and MIME handling package — Python 3.7.1 documentation  https://docs.python.org/3/library/email.html

email — An email and MIME handling package — Python 3.7.1 documentation  https://docs.python.org/3/library/email.html#module-email

email: Examples — Python 3.7.1 documentation  https://docs.python.org/3/library/email.examples.html

18.1.5. email.header: Internationalized headers — Python 2.7.15 documentation  https://docs.python.org/2/library/email.header.html

tcmime.1994.2551.9962.bin是个什么东西呢

Python 3中bytes/string的区别 - abce - 博客园  http://www.cnblogs.com/abclife/p/7445222.html

python-string和bytes的关系 - More and Better - CSDN博客  https://blog.csdn.net/qq_25730711/article/details/53817256

Python中email包的使用:


python发邮件详解,smtplib和email模块详解 - chinesepython的博客 - CSDN博客  https://blog.csdn.net/chinesepython/article/details/82465947

email:

The email package is a library for managing email messages. It is specifically not designed to do any sending of email messages to SMTP (RFC 2821), NNTP, or other servers; those are functions of modules such as smtplib and nntplib.

email包是一个管理电子邮件信息的库。它不是专门用来向SMTP,NNTP或其它服务器发送邮件信息,这些功能是smtplib包 和nntplib包的功能。

The overall structure of the email package can be divided into three major components, plus a fourth component that controls the behavior of the other components.

email包的整体结构分为三个主要组件,外加控制组件行为的第四个组件。

email模块下的mime模块下有常用的三个模块,三个模块中有三个大类。

如果构造MIMEText对象,表示文本邮件对象;如果构造MIMEImage对象,表示作为附件的图片对象;要把多个对象组合起来,就用MIMEMultipart对象,代表整个邮件。

MIMEText对象中需要设置三个参数:正文内容、正文内容的类型(例如:”text/plain”和”text/html”)、正文内容的编码。

 

 

from email.mime.text import MIMEText    
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart 

组件一:电子邮件信息的对象模型

The central component of the package is an “object model” that represents email messages. An application interacts with the package primarily through the object model interface defined in the message sub-module.

包核心组件是一个表示邮件信息的“对象模型”。应用程序主要通过信息子模块中定义的对象模型接口进行交互。

The application can use this API to ask questions about an existing email, to construct a new email, or to add or remove email subcomponents that themselves use the same object model interface.

应用程序用API来询问关于现有邮件的问题,构建一个新邮件,或者加入或者移除使用相同对象接口的email子组件。

That is, following the nature of email messages and their MIME subcomponents, the email object model is a tree structure of objects that all provide the EmailMessage API.

也就是说,根据电子邮件消息及其MIME子组件的性质,电子邮件对象模型是所有提供EmailMessage API的对象的树结构。

组件二、三:解析器、生成器

The other two major components of the package are the parser and the generator. The parser takes the serialized version of an email message (a stream of bytes) and converts it into a tree of EmailMessage objects. The generator takes an EmailMessage and turns it back into a serialized byte stream. (The parser and generator also handle streams of text characters, but this usage is discouraged as it is too easy to end up with messages that are not valid in one way or another.)

包的其他两个主要组件是解析器和生成器。解析器获取电子邮件消息的序列化版本(字节流)并将其转换为EmailMessage对象树。生成器接收电子邮件消息并将其转换回序列化的字节流。(解析器和生成器也处理文本字符流,但是这种用法是不鼓励的,因为它很容易以某种方式无效的消息结束。)

 

控制组件是策略模块

The control component is the policy module. Every EmailMessage, every generator, and every parser has an associated policy object that controls its behavior. Usually an application only needs to specify the policy when an EmailMessage is created, either by directly instantiating an EmailMessage to create a new email, or by parsing an input stream using a parser. But the policy can be changed when the message is serialized using a generator. This allows, for example, a generic email message to be parsed from disk, but to serialize it using standard SMTP settings when sending it to an email server.

每个电子邮件消息、每个生成器和每个解析器都有一个控制其行为的关联策略对象。通常,应用程序只需要在创建EmailMessage时指定策略,要么直接实例化EmailMessage来创建新电子邮件,要么使用解析器解析输入流。但是当使用生成器序列化消息时,可以更改策略。例如,这允许从磁盘解析一般的电子邮件消息,但是在将其发送到电子邮件服务器时,可以使用标准SMTP设置对其进行序列化。

 

mql4:

这篇关于python邮件处理(smtplib与email模块)、mql4中的邮件处理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/569544

相关文章

使用Python创建一个功能完整的Windows风格计算器程序

《使用Python创建一个功能完整的Windows风格计算器程序》:本文主要介绍如何使用Python和Tkinter创建一个功能完整的Windows风格计算器程序,包括基本运算、高级科学计算(如三... 目录python实现Windows系统计算器程序(含高级功能)1. 使用Tkinter实现基础计算器2.

Python开发文字版随机事件游戏的项目实例

《Python开发文字版随机事件游戏的项目实例》随机事件游戏是一种通过生成不可预测的事件来增强游戏体验的类型,在这篇博文中,我们将使用Python开发一款文字版随机事件游戏,通过这个项目,读者不仅能够... 目录项目概述2.1 游戏概念2.2 游戏特色2.3 目标玩家群体技术选择与环境准备3.1 开发环境3

Python中模块graphviz使用入门

《Python中模块graphviz使用入门》graphviz是一个用于创建和操作图形的Python库,本文主要介绍了Python中模块graphviz使用入门,具有一定的参考价值,感兴趣的可以了解一... 目录1.安装2. 基本用法2.1 输出图像格式2.2 图像style设置2.3 属性2.4 子图和聚

Python使用Matplotlib绘制3D曲面图详解

《Python使用Matplotlib绘制3D曲面图详解》:本文主要介绍Python使用Matplotlib绘制3D曲面图,在Python中,使用Matplotlib库绘制3D曲面图可以通过mpl... 目录准备工作绘制简单的 3D 曲面图绘制 3D 曲面图添加线框和透明度控制图形视角Matplotlib

一文教你Python如何快速精准抓取网页数据

《一文教你Python如何快速精准抓取网页数据》这篇文章主要为大家详细介绍了如何利用Python实现快速精准抓取网页数据,文中的示例代码简洁易懂,具有一定的借鉴价值,有需要的小伙伴可以了解下... 目录1. 准备工作2. 基础爬虫实现3. 高级功能扩展3.1 抓取文章详情3.2 保存数据到文件4. 完整示例

使用Python实现IP地址和端口状态检测与监控

《使用Python实现IP地址和端口状态检测与监控》在网络运维和服务器管理中,IP地址和端口的可用性监控是保障业务连续性的基础需求,本文将带你用Python从零打造一个高可用IP监控系统,感兴趣的小伙... 目录概述:为什么需要IP监控系统使用步骤说明1. 环境准备2. 系统部署3. 核心功能配置系统效果展

基于Python打造一个智能单词管理神器

《基于Python打造一个智能单词管理神器》这篇文章主要为大家详细介绍了如何使用Python打造一个智能单词管理神器,从查询到导出的一站式解决,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. 项目概述:为什么需要这个工具2. 环境搭建与快速入门2.1 环境要求2.2 首次运行配置3. 核心功能使用指

Python实现微信自动锁定工具

《Python实现微信自动锁定工具》在数字化办公时代,微信已成为职场沟通的重要工具,但临时离开时忘记锁屏可能导致敏感信息泄露,下面我们就来看看如何使用Python打造一个微信自动锁定工具吧... 目录引言:当微信隐私遇到自动化守护效果展示核心功能全景图技术亮点深度解析1. 无操作检测引擎2. 微信路径智能获

Python中pywin32 常用窗口操作的实现

《Python中pywin32常用窗口操作的实现》本文主要介绍了Python中pywin32常用窗口操作的实现,pywin32主要的作用是供Python开发者快速调用WindowsAPI的一个... 目录获取窗口句柄获取最前端窗口句柄获取指定坐标处的窗口根据窗口的完整标题匹配获取句柄根据窗口的类别匹配获取句

利用Python打造一个Excel记账模板

《利用Python打造一个Excel记账模板》这篇文章主要为大家详细介绍了如何使用Python打造一个超实用的Excel记账模板,可以帮助大家高效管理财务,迈向财富自由之路,感兴趣的小伙伴快跟随小编一... 目录设置预算百分比超支标红预警记账模板功能介绍基础记账预算管理可视化分析摸鱼时间理财法碎片时间利用财