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函数作用域示例详解

《Python函数作用域示例详解》本文介绍了Python中的LEGB作用域规则,详细解析了变量查找的四个层级,通过具体代码示例,展示了各层级的变量访问规则和特性,对python函数作用域相关知识感兴趣... 目录一、LEGB 规则二、作用域实例2.1 局部作用域(Local)2.2 闭包作用域(Enclos

Python实现对阿里云OSS对象存储的操作详解

《Python实现对阿里云OSS对象存储的操作详解》这篇文章主要为大家详细介绍了Python实现对阿里云OSS对象存储的操作相关知识,包括连接,上传,下载,列举等功能,感兴趣的小伙伴可以了解下... 目录一、直接使用代码二、详细使用1. 环境准备2. 初始化配置3. bucket配置创建4. 文件上传到os

使用Python实现可恢复式多线程下载器

《使用Python实现可恢复式多线程下载器》在数字时代,大文件下载已成为日常操作,本文将手把手教你用Python打造专业级下载器,实现断点续传,多线程加速,速度限制等功能,感兴趣的小伙伴可以了解下... 目录一、智能续传:从崩溃边缘抢救进度二、多线程加速:榨干网络带宽三、速度控制:做网络的好邻居四、终端交互

Python中注释使用方法举例详解

《Python中注释使用方法举例详解》在Python编程语言中注释是必不可少的一部分,它有助于提高代码的可读性和维护性,:本文主要介绍Python中注释使用方法的相关资料,需要的朋友可以参考下... 目录一、前言二、什么是注释?示例:三、单行注释语法:以 China编程# 开头,后面的内容为注释内容示例:示例:四

Python中win32包的安装及常见用途介绍

《Python中win32包的安装及常见用途介绍》在Windows环境下,PythonWin32模块通常随Python安装包一起安装,:本文主要介绍Python中win32包的安装及常见用途的相关... 目录前言主要组件安装方法常见用途1. 操作Windows注册表2. 操作Windows服务3. 窗口操作

Python中re模块结合正则表达式的实际应用案例

《Python中re模块结合正则表达式的实际应用案例》Python中的re模块是用于处理正则表达式的强大工具,正则表达式是一种用来匹配字符串的模式,它可以在文本中搜索和匹配特定的字符串模式,这篇文章主... 目录前言re模块常用函数一、查看文本中是否包含 A 或 B 字符串二、替换多个关键词为统一格式三、提

python常用的正则表达式及作用

《python常用的正则表达式及作用》正则表达式是处理字符串的强大工具,Python通过re模块提供正则表达式支持,本文给大家介绍python常用的正则表达式及作用详解,感兴趣的朋友跟随小编一起看看吧... 目录python常用正则表达式及作用基本匹配模式常用正则表达式示例常用量词边界匹配分组和捕获常用re

python实现对数据公钥加密与私钥解密

《python实现对数据公钥加密与私钥解密》这篇文章主要为大家详细介绍了如何使用python实现对数据公钥加密与私钥解密,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录公钥私钥的生成使用公钥加密使用私钥解密公钥私钥的生成这一部分,使用python生成公钥与私钥,然后保存在两个文

python删除xml中的w:ascii属性的步骤

《python删除xml中的w:ascii属性的步骤》使用xml.etree.ElementTree删除WordXML中w:ascii属性,需注册命名空间并定位rFonts元素,通过del操作删除属... 可以使用python的XML.etree.ElementTree模块通过以下步骤删除XML中的w:as

使用Python绘制3D堆叠条形图全解析

《使用Python绘制3D堆叠条形图全解析》在数据可视化的工具箱里,3D图表总能带来眼前一亮的效果,本文就来和大家聊聊如何使用Python实现绘制3D堆叠条形图,感兴趣的小伙伴可以了解下... 目录为什么选择 3D 堆叠条形图代码实现:从数据到 3D 世界的搭建核心代码逐行解析细节优化应用场景:3D 堆叠图