CN110855555A - Mail sending method, apparatus, device, and computer-readable storage medium - Google Patents
Mail sending method, apparatus, device, and computer-readable storage medium Download PDFInfo
- Publication number
- CN110855555A CN110855555A CN201911103307.3A CN201911103307A CN110855555A CN 110855555 A CN110855555 A CN 110855555A CN 201911103307 A CN201911103307 A CN 201911103307A CN 110855555 A CN110855555 A CN 110855555A
- Authority
- CN
- China
- Prior art keywords
- result set
- value
- preset
- sending
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 72
- 230000008569 process Effects 0.000 claims abstract description 27
- 238000012545 processing Methods 0.000 claims description 45
- 238000013507 mapping Methods 0.000 claims description 9
- 230000006870 function Effects 0.000 claims description 7
- 230000005540 biological transmission Effects 0.000 claims 8
- 238000010276 construction Methods 0.000 claims 1
- 238000011161 development Methods 0.000 abstract description 13
- 238000005516 engineering process Methods 0.000 abstract description 5
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000003672 processing method Methods 0.000 description 3
- 239000002699 waste material Substances 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 125000006850 spacer group Chemical group 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/42—Mailbox-related aspects, e.g. synchronisation of mailboxes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/06—Message adaptation to terminal or network requirements
- H04L51/066—Format adaptation, e.g. format conversion or compression
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
技术领域technical field
本发明涉及金融科技(Fintech)技术领域,尤其涉及一种邮件发送方法、装置、设备及计算机可读存储介质。The present invention relates to the technical field of financial technology (Fintech), and in particular, to a method, apparatus, device and computer-readable storage medium for sending emails.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,但由于金融行业的安全性、实时性要求,也对技术提出了更高的要求。With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually transforming into financial technology (Fintech). requirements.
电子邮件(简称E-mail)是一种用电子手段提供信息交换的通信方式,是互联网应用最广的服务,具有简易、快速的特点。通过电子邮件的方式,可以实现各类信息的传送、接收、存贮等处理,将邮件送到世界的各个角落。因此,邮件已经成为人们日常工作和生活中一个重要的沟通方式。E-mail (referred to as E-mail) is a communication method that provides information exchange by electronic means. It is the most widely used service on the Internet and has the characteristics of simplicity and speed. Through the way of e-mail, various types of information can be transmitted, received, stored, etc., and mails can be sent to all corners of the world. Therefore, email has become an important communication method in people's daily work and life.
目前,应用程序在发送邮件的过程中,会先获取需发送的应用数据,然后将原始格式的应用数据转换成邮件客户端可接收的结构化数据,得到邮件内容,进而根据部署环境中邮件服务提供方的实际情况,将邮件投递信息和邮件内容以规定的格式通过规定的接口传输给邮件客户端。由于各邮件客户端可接收的数据格式不尽相同,在对应用数据进行格式转换时,虽然有较为通用的格式集中转换的工具,但考虑到一个应用程序真正使用到的数据类型极为有限,引入通用的工具反而使应用的逻辑更加复杂,因此目前一般还是由应用程序反复实现相应的逻辑,从而造成开发人力的浪费、开发效率也较低。At present, in the process of sending an email, an application first obtains the application data to be sent, and then converts the application data in the original format into structured data that the email client can receive to obtain the content of the email, and then according to the email service in the deployment environment According to the actual situation of the provider, the mail delivery information and the content of the mail are transmitted to the mail client in the specified format through the specified interface. Since the data formats that can be received by each mail client are not the same, when converting the application data, although there are more general tools for centralized format conversion, considering that the data types actually used by an application are extremely limited, the introduction of Common tools make the logic of the application more complicated, so the corresponding logic is generally implemented repeatedly by the application program, resulting in waste of development manpower and low development efficiency.
发明内容SUMMARY OF THE INVENTION
本发明的主要目的在于提供一种邮件发送方法、装置、设备及计算机可读存储介质,旨在解决现有的邮件发送功能开发过程中、开发效率较低的问题。The main purpose of the present invention is to provide a mail sending method, device, device and computer-readable storage medium, aiming to solve the problem of low development efficiency in the development process of the existing mail sending function.
为实现上述目的,本发明提供一种邮件发送方法,所述邮件发送方法包括:In order to achieve the above object, the present invention provides a method for sending mail, which includes:
在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息,所述邮件内容包括元数据信息和结果集的值;When receiving a mail sending request, obtain mail content and basic mail information according to the mail sending request, where the mail content includes metadata information and the value of the result set;
根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象;Determine the corresponding target content parser according to the data type in the metadata information, and perform parsing processing on the value of the result set by the target content parser to obtain an intermediate object;
按解析顺序对所述中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文;Merge the intermediate objects in the parsing order, and insert the merged intermediate objects into the preset structure to obtain the email body;
基于所述邮件基本信息对所述邮件正文进行发送。The email body is sent based on the email basic information.
可选地,所述在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息的步骤包括:Optionally, when receiving an email sending request, the steps of obtaining the email content and the basic information of the email according to the email sending request include:
在接收到邮件发送请求时,根据所述邮件发送请求获取作业编号ID、用户名和邮件基本信息;When receiving the email sending request, obtain the job number ID, user name and basic email information according to the email sending request;
根据所述作业ID、所述用户名和预先配置的根目录生成结果集路径,并根据所述结果集路径获取邮件内容。A result set path is generated according to the job ID, the user name and the preconfigured root directory, and mail content is acquired according to the result set path.
可选地,所述根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象的步骤包括:Optionally, the step of determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set by the target content parser, to obtain an intermediate object includes:
若所述元数据信息中的数据类型为图片,则确定对应的目标内容解析器为图片内容解析器;If the data type in the metadata information is a picture, then determine that the corresponding target content parser is a picture content parser;
通过所述图片内容解析器从所述元数据信息中获取图片格式,并将所述结果集的值还原成与所述图片格式对应的图片数据;Obtain a picture format from the metadata information by using the picture content parser, and restore the value of the result set to picture data corresponding to the picture format;
调用预设构造函数对所述图片数据进行处理,得到处理对象;calling a preset constructor to process the image data to obtain a processing object;
基于所述处理对象和预设图片标签格式,生成对应的图片标签,并将所述图片标签作为中间对象。Based on the processing object and the preset picture label format, a corresponding picture label is generated, and the picture label is used as an intermediate object.
可选地,所述根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象的步骤包括:Optionally, the step of determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set by the target content parser, to obtain an intermediate object includes:
若所述元数据信息中的数据类型为超文本标记语言HTML,则确定对应的目标内容解析器为HTML内容解析器;If the data type in the metadata information is HTML, then determine that the corresponding target content parser is an HTML content parser;
通过所述HTML内容解析器校验所述结果集的值是否符合预设邮件HTML规范;Checking, by the HTML content parser, whether the value of the result set conforms to the preset mail HTML specification;
若符合,则从所述结果集的值中提取出正文体标签内的子HTML,并将所述子HTML作为中间对象。If it matches, extract the sub-HTML in the body tag from the value of the result set, and use the sub-HTML as an intermediate object.
可选地,所述根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象的步骤包括:Optionally, the step of determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set by the target content parser, to obtain an intermediate object includes:
若所述元数据信息中的数据类型为表格,则确定对应的目标内容解析器为表格内容解析器;If the data type in the metadata information is a table, then determine that the corresponding target content parser is a table content parser;
通过所述表格内容解析器读取所述元数据信息中的字段名称,基于所述字段名称生成对应的第一单元格标签,并将所述第一单元格标签嵌套在预设表头标签内;The field name in the metadata information is read by the table content parser, a corresponding first cell label is generated based on the field name, and the first cell label is nested in a preset header label Inside;
根据所述结果集的值获取表格行数及表格各行内部各列的值,生成与所述表格行数相同数量的行标签;Obtain the number of table rows and the value of each column in each row of the table according to the value of the result set, and generate the same number of row labels as the number of table rows;
根据所述表格各行内部各列的值生成对应的第二单元格标签,并将所述第二单元格标签嵌套在对应的行标签内;Generate a corresponding second cell label according to the value of each column in each row of the table, and nest the second cell label in the corresponding row label;
将嵌套后的预设表头标签内的文本与嵌套后的行标签内的文本进行合并,并嵌套至预设表格标签内,得到中间对象。The text in the nested preset header tag is merged with the text in the nested row tag, and nested into the preset table tag to obtain an intermediate object.
可选地,所述根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象的步骤包括:Optionally, the step of determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set by the target content parser, to obtain an intermediate object includes:
若所述元数据信息中的数据类型为文件,则确定对应的目标内容解析器为文件内容解析器;If the data type in the metadata information is a file, then determine that the corresponding target content parser is a file content parser;
通过所述文件内容解析器检测所述结果集的值为单行还是多行;Detect, by the file content parser, whether the value of the result set is a single line or multiple lines;
若所述结果集的值为单行,则将所述结果集的值作为预设段落标签的内容,得到中间对象;If the value of the result set is a single line, the value of the result set is used as the content of the preset paragraph label to obtain an intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,基于分行处理结果、所述预设段落标签和预设换行标签,得到中间对象。If the value of the result set has multiple lines, the value of the result set is processed by line, and an intermediate object is obtained based on the result of the line branch processing, the preset paragraph label and the preset line break label.
可选地,所述根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象的步骤包括:Optionally, the step of determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set by the target content parser, to obtain an intermediate object includes:
若所述元数据信息中的数据类型为链接,则确定对应的目标内容解析器为链接内容解析器;If the data type in the metadata information is a link, then determine that the corresponding target content parser is a link content parser;
通过所述链接内容解析器检测所述结果集的值为单行还是多行;Detecting whether the value of the result set is a single line or multiple lines by the link content parser;
若所述结果集的值为单行,则将所述结果集的值转换成第一超链接标签,并将所述邮件内容对应的结果集的文件名作为所述第一超链接标签的提示信息,得到中间对象;If the value of the result set is a single line, convert the value of the result set into a first hyperlink label, and use the file name of the result set corresponding to the content of the email as the prompt information of the first hyperlink label , get the intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,将分行后的结果集的值分别转换成对应的第二超链接标签;If the value of the result set is multi-row, then the value of the result set is processed by branch, and the value of the result set after the branch is converted into the corresponding second hyperlink label respectively;
对所述第二超链接标签进行合并,并将所述邮件内容对应的结果集的文件名作为合并后的第二超链接标签的提示信息,得到中间对象。The second hyperlink labels are merged, and the file name of the result set corresponding to the content of the email is used as the prompt information of the merged second hyperlink label to obtain an intermediate object.
可选地,所述基于所述基本信息对所述邮件正文进行发送的步骤包括:Optionally, the step of sending the email body based on the basic information includes:
获取当前环境可支持的邮件客户端类型,并根据所述当前环境可支持的邮件客户端类型和预设映射关系创建对应类型的邮件对象;Obtain the mail client type supported by the current environment, and create a mail object of the corresponding type according to the mail client type supported by the current environment and the preset mapping relationship;
将所述邮件正文和所述邮件基本信息填充至所述邮件对象中,并将填充后的邮件对象提交至预设邮件客户端进行发送。Filling the email body and the email basic information into the email object, and submitting the filled email object to a preset email client for sending.
此外,为实现上述目的,本发明还提供一种邮件发送装置,所述邮件发送装置包括:In addition, in order to achieve the above object, the present invention also provides a mail sending device, the mail sending device includes:
获取模块,用于在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息,所述邮件内容包括元数据信息和结果集的值;an obtaining module, configured to obtain mail content and basic mail information according to the mail sending request when receiving the mail sending request, where the mail content includes metadata information and the value of the result set;
解析模块,用于根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象;a parsing module, configured to determine a corresponding target content parser according to the data type in the metadata information, and perform parsing processing on the value of the result set through the target content parser to obtain an intermediate object;
合并模块,用于按解析顺序对所述中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文;a merging module, used for merging the intermediate objects according to the parsing order, and inserting the merged intermediate objects into the preset structure to obtain the email body;
发送模块,用于基于所述基本信息对所述邮件正文进行发送。A sending module, configured to send the email body based on the basic information.
此外,为实现上述目的,本发明还提供一种邮件发送设备,所述邮件发送设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的邮件发送程序,所述邮件发送程序被所述处理器执行时实现如上所述的邮件发送方法的步骤。In addition, in order to achieve the above object, the present invention also provides a mail sending device, the mail sending device includes: a memory, a processor and a mail sending program stored on the memory and running on the processor, When the mail sending program is executed by the processor, the steps of the mail sending method described above are realized.
此外,为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有邮件发送程序,所述邮件发送程序被处理器执行时实现如上所述的邮件发送方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium on which a mail sending program is stored, and when the mail sending program is executed by the processor, the above-mentioned mail sending is realized steps of the method.
本发明提供一种邮件发送方法、装置、设备及计算机可读存储介质,在接收到邮件发送请求时,可根据邮件发送请求获取邮件内容和邮件基本信息;然后,根据元数据信息中的数据类型确定对应的目标内容解析器,并通过目标内容解析器对结果集的值进行解析处理,得到中间对象;进而按解析顺序对中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文,基于邮件基本信息对邮件正文进行发送。本发明为了适配各种邮件客户端的数据格式,针对不同的数据类型定义了对应的标准解析处理方式,可统一将邮件内容的格式转换成一标准的中间格式,以得到邮件内容,进而进行发送,从而实现了数据格式的统一转换,无需应用程序反复实现相应的逻辑,因此,本发明可提高邮件发送功能开发过程中的开发效率。The present invention provides a mail sending method, device, equipment and computer-readable storage medium. When a mail sending request is received, the mail content and basic mail information can be obtained according to the mail sending request; then, according to the data type in the metadata information Determine the corresponding target content parser, and parse and process the value of the result set through the target content parser to obtain an intermediate object; then merge the intermediate objects according to the parsing order, and insert the merged intermediate object into the preset structure, The email body is obtained, and the email body is sent based on the basic information of the email. In order to adapt to the data formats of various mail clients, the present invention defines corresponding standard parsing and processing methods for different data types, and can uniformly convert the format of the mail content into a standard intermediate format, so as to obtain the mail content, and then send it. Therefore, the unified conversion of the data format is realized, and the application program does not need to repeatedly realize the corresponding logic. Therefore, the present invention can improve the development efficiency in the development process of the mail sending function.
附图说明Description of drawings
图1为本发明实施例方案涉及的硬件运行环境的设备结构示意图;1 is a schematic diagram of a device structure of a hardware operating environment involved in an embodiment of the present invention;
图2为本发明邮件发送方法第一实施例的流程示意图;Fig. 2 is the schematic flow chart of the first embodiment of the mail sending method of the present invention;
图3为本发明邮件发送装置第一实施例的功能模块示意图。FIG. 3 is a schematic diagram of functional modules of the first embodiment of the mail sending apparatus of the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
参照图1,图1为本发明实施例方案涉及的硬件运行环境的设备结构示意图。Referring to FIG. 1 , FIG. 1 is a schematic diagram of a device structure of a hardware operating environment involved in an embodiment of the present invention.
本发明实施例邮件发送设备可以是智能手机,也可以是PC(Personal Computer,个人计算机)、平板电脑、便携计算机等终端设备。The mail sending device in the embodiment of the present invention may be a smart phone, or may be a terminal device such as a PC (Personal Computer, personal computer), a tablet computer, a portable computer, and the like.
如图1所示,该邮件发送设备可以包括:处理器1001,例如CPU,通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如Wi-Fi接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1 , the mail sending device may include: a
本领域技术人员可以理解,图1中示出的邮件发送设备结构并不构成对邮件发送设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the mail sending device shown in FIG. 1 does not constitute a limitation on the mail sending device, and may include more or less components than the one shown, or combine some components, or different components layout.
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及邮件发送程序。As shown in FIG. 1 , the
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端,与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的邮件发送程序,并执行以下操作:In the terminal shown in FIG. 1 , the
在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息,所述邮件内容包括元数据信息和结果集的值;When receiving a mail sending request, obtain mail content and basic mail information according to the mail sending request, where the mail content includes metadata information and the value of the result set;
根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象;Determine the corresponding target content parser according to the data type in the metadata information, and perform parsing processing on the value of the result set by the target content parser to obtain an intermediate object;
按解析顺序对所述中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文;Merge the intermediate objects in the parsing order, and insert the merged intermediate objects into the preset structure to obtain the email body;
基于所述邮件基本信息对所述邮件正文进行发送。The email body is sent based on the email basic information.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
在接收到邮件发送请求时,根据所述邮件发送请求获取作业编号ID、用户名和邮件基本信息;When receiving the email sending request, obtain the job number ID, user name and basic email information according to the email sending request;
根据所述作业ID、所述用户名和预先配置的根目录生成结果集路径,并根据所述结果集路径获取邮件内容。A result set path is generated according to the job ID, the user name and the preconfigured root directory, and mail content is acquired according to the result set path.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
若所述元数据信息中的数据类型为图片,则确定对应的目标内容解析器为图片内容解析器;If the data type in the metadata information is a picture, then determine that the corresponding target content parser is a picture content parser;
通过所述图片内容解析器从所述元数据信息中获取图片格式,并将所述结果集的值还原成与所述图片格式对应的图片数据;Obtain a picture format from the metadata information by using the picture content parser, and restore the value of the result set to picture data corresponding to the picture format;
调用预设构造函数对所述图片数据进行处理,得到处理对象;calling a preset constructor to process the image data to obtain a processing object;
基于所述处理对象和预设图片标签格式,生成对应的图片标签,并将所述图片标签作为中间对象。Based on the processing object and the preset picture label format, a corresponding picture label is generated, and the picture label is used as an intermediate object.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
若所述元数据信息中的数据类型为超文本标记语言HTML,则确定对应的目标内容解析器为HTML内容解析器;If the data type in the metadata information is HTML, then determine that the corresponding target content parser is an HTML content parser;
通过所述HTML内容解析器校验所述结果集的值是否符合预设邮件HTML规范;Checking, by the HTML content parser, whether the value of the result set conforms to the preset mail HTML specification;
若符合,则从所述结果集的值中提取出正文体标签内的子HTML,并将所述子HTML作为中间对象。If it matches, extract the sub-HTML in the body tag from the value of the result set, and use the sub-HTML as an intermediate object.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
若所述元数据信息中的数据类型为表格,则确定对应的目标内容解析器为表格内容解析器;If the data type in the metadata information is a table, then determine that the corresponding target content parser is a table content parser;
通过所述表格内容解析器读取所述元数据信息中的字段名称,基于所述字段名称生成对应的第一单元格标签,并将所述第一单元格标签嵌套在预设表头标签内;The field name in the metadata information is read by the table content parser, a corresponding first cell label is generated based on the field name, and the first cell label is nested in a preset header label Inside;
根据所述结果集的值获取表格行数及表格各行内部各列的值,生成与所述表格行数相同数量的行标签;Obtain the number of table rows and the value of each column in each row of the table according to the value of the result set, and generate the same number of row labels as the number of table rows;
根据所述表格各行内部各列的值生成对应的第二单元格标签,并将所述第二单元格标签嵌套在对应的行标签内;Generate a corresponding second cell label according to the value of each column in each row of the table, and nest the second cell label in the corresponding row label;
将嵌套后的预设表头标签内的文本与嵌套后的行标签内的文本进行合并,并嵌套至预设表格标签内,得到中间对象。The text in the nested preset header tag is merged with the text in the nested row tag, and nested into the preset table tag to obtain an intermediate object.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
若所述元数据信息中的数据类型为文件,则确定对应的目标内容解析器为文件内容解析器;If the data type in the metadata information is a file, then determine that the corresponding target content parser is a file content parser;
通过所述文件内容解析器检测所述结果集的值为单行还是多行;Detect, by the file content parser, whether the value of the result set is a single line or multiple lines;
若所述结果集的值为单行,则将所述结果集的值作为预设段落标签的内容,得到中间对象;If the value of the result set is a single line, the value of the result set is used as the content of the preset paragraph label to obtain an intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,基于分行处理结果、所述预设段落标签和预设换行标签,得到中间对象。If the value of the result set has multiple lines, the value of the result set is processed by line, and an intermediate object is obtained based on the result of the line branch processing, the preset paragraph label and the preset line break label.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
若所述元数据信息中的数据类型为链接,则确定对应的目标内容解析器为链接内容解析器;If the data type in the metadata information is a link, then determine that the corresponding target content parser is a link content parser;
通过所述链接内容解析器检测所述结果集的值为单行还是多行;Detecting whether the value of the result set is a single line or multiple lines by the link content parser;
若所述结果集的值为单行,则将所述结果集的值转换成第一超链接标签,并将所述邮件内容对应的结果集的文件名作为所述第一超链接标签的提示信息,得到中间对象;If the value of the result set is a single line, convert the value of the result set into a first hyperlink label, and use the file name of the result set corresponding to the content of the email as the prompt information of the first hyperlink label , get the intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,将分行后的结果集的值分别转换成对应的第二超链接标签;If the value of the result set is multi-row, then the value of the result set is processed by branch, and the value of the result set after the branch is converted into the corresponding second hyperlink label respectively;
对所述第二超链接标签进行合并,并将所述邮件内容对应的结果集的文件名作为合并后的第二超链接标签的提示信息,得到中间对象。The second hyperlink labels are merged, and the file name of the result set corresponding to the content of the email is used as the prompt information of the merged second hyperlink label to obtain an intermediate object.
进一步地,处理器1001可以调用存储器1005中存储的邮件发送程序,还执行以下操作:Further, the
获取当前环境可支持的邮件客户端类型,并根据所述当前环境可支持的邮件客户端类型和预设映射关系创建对应类型的邮件对象;Obtain the mail client type supported by the current environment, and create a mail object of the corresponding type according to the mail client type supported by the current environment and the preset mapping relationship;
将所述邮件正文和所述邮件基本信息填充至所述邮件对象中,并将填充后的邮件对象提交至预设邮件客户端进行发送。Filling the email body and the email basic information into the email object, and submitting the filled email object to a preset email client for sending.
基于上述硬件结构,提出本发明邮件发送方法的各实施例。Based on the above hardware structure, various embodiments of the mail sending method of the present invention are proposed.
本发明提供一种邮件发送方法。The present invention provides a mail sending method.
参照图2,图2为本发明邮件发送方法第一实施例的流程示意图。Referring to FIG. 2, FIG. 2 is a schematic flowchart of the first embodiment of the mail sending method of the present invention.
在本实施例中,该邮件发送方法包括:In this embodiment, the mail sending method includes:
步骤S10,在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息,所述邮件内容包括元数据信息和结果集的值;Step S10, when receiving a mail sending request, obtain mail content and basic mail information according to the mail sending request, where the mail content includes metadata information and the value of the result set;
本实施例的邮件发送方法是由邮件发送设备实现的,该设备中搭载有邮件发送器和各种类型的内容解析器。在本实施例中,是将邮件发送作为一个节点置于工作流中,使得在一系列逻辑中、能够简单灵活的定义在某些步骤之后进行邮件的发送,无需针对具体情况做相应的特定实现。具体的,工作流中的预设节点在执行完任务后,可触发对应的邮件发送请求,此时,邮件发送器在接收到邮件发送请求时,可根据邮件发送请求获取邮件内容和邮件基本信息,其中,邮件内容包括元数据信息和结果集的值,元数据信息包括数据类型(如图片、表格、文本、链接等)和数据基本信息(如大小、字段名称、字段类型等)。具体的,步骤S10包括:The mail sending method of this embodiment is implemented by a mail sending device, and the device is equipped with a mail sender and various types of content parsers. In this embodiment, mail sending is placed in the workflow as a node, so that in a series of logic, it is possible to define the sending of mail after certain steps in a simple and flexible manner, without the need to make corresponding specific implementations for specific situations . Specifically, the preset node in the workflow can trigger a corresponding email sending request after executing the task. At this time, when the email sender receives the email sending request, it can obtain the email content and basic email information according to the email sending request. , where the email content includes metadata information and the value of the result set. The metadata information includes data types (such as pictures, tables, text, links, etc.) and basic data information (such as size, field name, field type, etc.). Specifically, step S10 includes:
步骤a1,在接收到邮件发送请求时,根据所述邮件发送请求获取作业编号ID、用户名和邮件基本信息;Step a1, when receiving a mail sending request, obtain job number ID, user name and basic mail information according to the mail sending request;
步骤a2,根据所述作业ID、所述用户名和预先配置的根目录生成结果集路径,并根据所述结果集路径获取邮件内容。Step a2: Generate a result set path according to the job ID, the user name and the pre-configured root directory, and obtain email content according to the result set path.
在接收到邮件发送请求时,通过邮件发送器根据邮件发送请求获取作业ID(Identity document,编号)、用户名和邮件基本信息,其中,作业ID即为工作流上邮件发送器所在节点的前置节点的作业ID,同时也是触发该邮件发送请求的节点的作业ID,邮件基本信息包括但不限于发件人、收件人、邮件标题等。然后,根据作业ID、用户名和预先配置的根目录生成结果集路径,其中,结果路路径的生成方式可以预设格式进行生成,其中预设格式可以为{预先配置的根目录+用户名+作业ID},在得到结果集路径后,根据结果集路径获取邮件内容。其中,邮件内容即为根据结果集路径获取到的结果集,为前置节点的执行结果。通过上述方式,可以将工作流中的前置节点作为邮件内容进行发送,并通过工作流的上下文共享机制,以统一的方式来获取节点的执行结果作为邮件内容。When an email sending request is received, the email sender obtains the job ID (Identity document, number), user name and basic email information according to the email sending request, where the job ID is the front node of the node where the email sender is located in the workflow The job ID is also the job ID of the node that triggers the email sending request. The basic email information includes but is not limited to sender, recipient, email title, etc. Then, the result set path is generated according to the job ID, the user name and the preconfigured root directory, wherein the generation method of the result path path can be generated in a preset format, wherein the preset format can be {preconfigured root directory + user name + job ID}, after obtaining the result set path, obtain the email content according to the result set path. The content of the email is the result set obtained according to the result set path, which is the execution result of the front node. In the above manner, the front node in the workflow can be sent as the content of the email, and the execution result of the node can be obtained as the content of the email in a unified manner through the context sharing mechanism of the workflow.
步骤S20,根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象;Step S20, determining a corresponding target content parser according to the data type in the metadata information, and performing parsing processing on the value of the result set through the target content parser to obtain an intermediate object;
然后,根据元数据信息中的数据类型确定对应的目标内容解析器,并通过目标内容解析器对结果集的值进行解析处理,得到中间对象。其中,数据类型包括但不限于图片、HTML(HyperText Markup Language,超级文本标记语言)、表格、文件和链接,不同的数据类型对应有不同的解析处理过程,具体的解析处理过程可参照下述第二实施例,此处不作赘述。通过针对不同的数据类型定义对应的标准解析处理方式,可统一将邮件内容的格式转换成一标准的中间格式,从而无需应用反复实现相应逻辑,可避免开发人力的浪费,提高邮件发送功能的开发效率。Then, the corresponding target content parser is determined according to the data type in the metadata information, and the value of the result set is parsed and processed by the target content parser to obtain an intermediate object. Among them, the data types include but are not limited to pictures, HTML (HyperText Markup Language, Hyper Text Markup Language), tables, files and links. Different data types have different parsing processes. For the specific parsing process, please refer to the following section. The second embodiment will not be repeated here. By defining corresponding standard parsing and processing methods for different data types, the format of the email content can be uniformly converted into a standard intermediate format, so that there is no need to apply the corresponding logic repeatedly, which can avoid the waste of development manpower and improve the development efficiency of the email sending function. .
步骤S30,按解析顺序对所述中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文;Step S30, merging the intermediate objects according to the parsing order, and inserting the merged intermediate objects into the preset structure to obtain the email body;
在得到中间对象之后,按解析顺序对中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文。在合并时,只是简单地按照解析顺序将中间对象合并为一个完整的HTML结构(即简单的String+String),预设结构,可选地为<html><body></body></html>,可将合并后的中间对象插入预设结构的<body>和</body>之间,以得到一完整结构,作为最终的邮件正文。After the intermediate objects are obtained, the intermediate objects are merged according to the parsing order, and the merged intermediate objects are inserted into the preset structure to obtain the email body. When merging, it simply merges the intermediate objects into a complete HTML structure (ie, a simple String+String) according to the parsing order, and the preset structure is optionally <html><body></body></html >, the merged intermediate object can be inserted between <body> and </body> of the preset structure to obtain a complete structure as the final email body.
步骤S40,基于所述邮件基本信息对所述邮件正文进行发送。Step S40, sending the email body based on the email basic information.
在得到邮件正文之后,基于邮件基本信息对邮件正文进行发送。具体的,步骤S40包括:After the email body is obtained, the email body is sent based on the basic information of the email. Specifically, step S40 includes:
步骤b1,获取当前环境可支持的邮件客户端类型,并根据所述当前环境可支持的邮件客户端类型和预设映射关系创建对应类型的邮件对象;Step b1, obtain the mail client type that can be supported by the current environment, and create a mail object of the corresponding type according to the mail client type that can be supported by the current environment and the preset mapping relationship;
步骤b2,将所述邮件正文和所述邮件基本信息填充至所述邮件对象中,并将填充后的邮件对象提交至预设邮件客户端进行发送。Step b2, filling the email body and the email basic information into the email object, and submitting the filled email object to a preset email client for sending.
在得到邮件正文之后,获取当前环境可支持的邮件客户端类型,并根据当前环境可支持的邮件客户端类型和预设映射关系创建对应类型的邮件对象,其中,预设映射关系包括邮件客户端类型与邮件对象类型之间的映射关系,例如,邮件客户端类型为SpringJavaMail(即指通过Spring提供的JavaMailSender接口实现邮件发送)时,可创建MIME(Multipurpose Internet Mail Extensions,多用途互联网邮件扩展)对象;邮件客户端类型为HTTP邮件客户端(即指基于HTTP协议实现邮件发送的邮件客户端)时,可创建Json(JavaScript Object Notation,JS对象简谱,轻量级的数据交换格式)对象。然后,将邮件正文和邮件基本信息填充至邮件对象中,并将填充后的邮件对象提交至预设邮件客户端进行发送。当然,可以理解,预设映射关系中可提供多种常见邮件客户端的支持,同时可留有对应的扩展空间给其他客户端,以实现可支持邮件客户端扩展的灵活性。通过上述方式,可实现多种客户端接口的适配。After obtaining the email body, obtain the email client type supported by the current environment, and create a corresponding type of email object according to the email client type supported by the current environment and a preset mapping relationship, where the preset mapping relationship includes the email client The mapping relationship between the type and the mail object type. For example, when the mail client type is SpringJavaMail (that is, when the mail is sent through the JavaMailSender interface provided by Spring), a MIME (Multipurpose Internet Mail Extensions, Multipurpose Internet Mail Extensions) object can be created. ; When the mail client type is HTTP mail client (that is, the mail client that implements mail sending based on HTTP protocol), Json (JavaScript Object Notation, JS Object Notation, lightweight data exchange format) object can be created. Then, fill the email body and basic email information into the email object, and submit the filled email object to a preset email client for sending. Of course, it can be understood that the preset mapping relationship can provide support for a variety of common email clients, and at the same time, corresponding expansion space can be reserved for other clients, so as to realize the flexibility to support the expansion of email clients. In the above manner, adaptation of various client interfaces can be realized.
本发明实施例提供一种邮件发送方法,在接收到邮件发送请求时,可根据邮件发送请求获取邮件内容和邮件基本信息;然后,根据元数据信息中的数据类型确定对应的目标内容解析器,并通过目标内容解析器对结果集的值进行解析处理,得到中间对象;进而按解析顺序对中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文,基于邮件基本信息对邮件正文进行发送。本发明实施例为了适配各种邮件客户端的数据格式,针对不同的数据类型定义了对应的标准解析处理方式,可统一将邮件内容的格式转换成一标准的中间格式,以得到邮件内容,进而进行发送,通过上述方式,可实现数据格式的统一转换,无需应用程序反复实现相应的逻辑,因此,可提高邮件发送功能开发过程中的开发效率,节省人力。An embodiment of the present invention provides a method for sending mail. When a request for sending mail is received, the content of the mail and basic information of the mail can be obtained according to the request for sending mail; then, a corresponding target content parser is determined according to the data type in the metadata information, And the value of the result set is parsed by the target content parser to obtain an intermediate object; then the intermediate objects are merged according to the parsing order, and the merged intermediate objects are inserted into the preset structure to obtain the email body, based on the basic information of the email Send the message body. In order to adapt to the data formats of various mail clients, the embodiment of the present invention defines corresponding standard parsing and processing methods for different data types, and can uniformly convert the format of the mail content into a standard intermediate format, so as to obtain the mail content, and then carry out Sending, through the above method, unified conversion of data formats can be achieved, and the application program does not need to repeatedly implement corresponding logic. Therefore, the development efficiency in the development process of the mail sending function can be improved, and manpower can be saved.
进一步的,基于上述第一实施例,提出本发明邮件发送方法的第二实施例。Further, based on the above-mentioned first embodiment, a second embodiment of the mail sending method of the present invention is proposed.
在本实施例中,步骤S20可以包括:In this embodiment, step S20 may include:
步骤c11,若所述元数据信息中的数据类型为图片,则确定对应的目标内容解析器为图片内容解析器;Step c11, if the data type in the metadata information is a picture, then determine that the corresponding target content parser is a picture content parser;
步骤c12,通过所述图片内容解析器从所述元数据信息中获取图片格式,并将所述结果集的值还原成与所述图片格式对应的图片数据;Step c12, obtaining the picture format from the metadata information through the picture content parser, and restoring the value of the result set to picture data corresponding to the picture format;
步骤c13,调用预设构造函数对所述图片数据进行处理,得到处理对象;Step c13, calling a preset constructor to process the picture data to obtain a processing object;
步骤c14,基于所述处理对象和预设图片标签格式,生成对应的图片标签,并将所述图片标签作为中间对象。Step c14, based on the processing object and the preset picture label format, generate a corresponding picture label, and use the picture label as an intermediate object.
本实施例中介绍了图片类数据的处理过程。具体过程如下:若元数据信息中的数据类型为图片,则确定对应的目标内容解析器为图片内容解析器;然后,通过图片内容解析器从元数据信息中获取图片格式(如png、jpg等),并将结果集的值还原成与图片格式对应的图片数据;进而调用预设构造函数对图片数据进行处理,得到处理对象,其中,预设构造函数可选为BufferedImage构造函数,通过调用BufferedImage构造函数,可实现对图片数据的缩放处理、灰度处理等。最后,基于处理对象和预设图片标签格式,生成对应的图片标签,并将图片标签作为中间对象。其中,预设图片格式标签为<img>标签,最终生成的图片标签的格式可以为:<img src=’data:image/jpeg;base64,{图片的base64编码}’></img>。This embodiment introduces a process of processing image data. The specific process is as follows: if the data type in the metadata information is a picture, the corresponding target content parser is determined as the picture content parser; then, the picture format (such as png, jpg, etc.) is obtained from the metadata information through the picture content parser ), and restore the value of the result set to the image data corresponding to the image format; then call the preset constructor to process the image data to obtain the processing object, wherein the preset constructor can be selected as the BufferedImage constructor, by calling the BufferedImage constructor Constructor, which can realize zoom processing and grayscale processing of image data. Finally, based on the processing object and the preset picture label format, the corresponding picture label is generated, and the picture label is used as an intermediate object. Wherein, the preset picture format label is the <img> label, and the format of the final generated picture label may be: <img src='data:image/jpeg;base64,{base64 encoding of the picture}'></img>.
进一步地,步骤S20还可以包括:Further, step S20 may also include:
步骤c21,若所述元数据信息中的数据类型为超文本标记语言HTML,则确定对应的目标内容解析器为HTML内容解析器;Step c21, if the data type in the metadata information is HTML, then determine that the corresponding target content parser is an HTML content parser;
步骤c22,通过所述HTML内容解析器校验所述结果集的值是否符合预设邮件HTML规范;Step c22, checking whether the value of the result set complies with the preset mail HTML specification by the HTML content parser;
步骤c23,若符合,则从所述结果集的值中提取出正文体标签内的子HTML,并将所述子HTML作为中间对象。Step c23, if it matches, extract the sub-HTML in the main body tag from the value of the result set, and use the sub-HTML as an intermediate object.
本实施例中介绍了HTML类数据的处理过程。具体过程如下:若元数据信息中的数据类型为HTML(HyperText Markup Language,超文本标记语言),则确定对应的目标内容解析器为HTML内容解析器;然后,通过HTML内容解析器校验结果集的值是否符合预设邮件HTML规范,其中,预设邮件HTML规范可以包括但不限于:具有完整的<html><body></body></html>结构,标签均有闭合,使用的是HTML支持的标签,没有嵌套使用JavaScript脚本等。若符合预设邮件HTML规范,则从结果集的值中提取出正文体标签内的子HTML,并将子HTML作为中间对象。其中,正文体标签为<body>标签。In this embodiment, the processing process of HTML class data is introduced. The specific process is as follows: if the data type in the metadata information is HTML (HyperText Markup Language), the corresponding target content parser is determined to be an HTML content parser; then, the result set is verified by the HTML content parser Whether the value conforms to the default email HTML specification, where the default email HTML specification may include but is not limited to: having a complete <html><body></body></html> structure, all tags are closed, and using HTML supported tags, no nested use of JavaScript scripts, etc. If it conforms to the preset mail HTML specification, the sub-HTML in the main body tag is extracted from the value of the result set, and the sub-HTML is used as an intermediate object. The main body tag is the <body> tag.
进一步地,步骤S20还可以包括:Further, step S20 may also include:
步骤c31,若所述元数据信息中的数据类型为表格,则确定对应的目标内容解析器为表格内容解析器;Step c31, if the data type in the metadata information is a table, then determine that the corresponding target content parser is a table content parser;
步骤c32,通过所述表格内容解析器读取所述元数据信息中的字段名称,基于所述字段名称生成对应的第一单元格标签,并将所述第一单元格标签嵌套在预设表头标签内;Step c32, read the field name in the metadata information through the table content parser, generate a corresponding first cell label based on the field name, and nest the first cell label in a preset in the header tag;
步骤c33,根据所述结果集的值获取表格行数及表格各行内部各列的值,生成与所述表格行数相同数量的行标签;Step c33, obtains the table row number and the value of each column inside each row of the table according to the value of the result set, and generates the same number of row labels as the table row number;
步骤c34,根据所述表格各行内部各列的值生成对应的第二单元格标签,并将所述第二单元格标签嵌套在对应的行标签内;Step c34, generating a corresponding second cell label according to the value of each column inside each row of the table, and nesting the second cell label in the corresponding row label;
步骤c35,将嵌套后的预设表头标签内的文本与嵌套后的行标签内的文本进行合并,并嵌套至预设表格标签内,得到中间对象。In step c35, the text in the nested preset header tag and the text in the nested row tag are combined, and nested into the preset table tag to obtain an intermediate object.
本实施例中介绍了表格类数据的处理过程。具体过程如下:若元数据信息中的数据类型为表格,则确定对应的目标内容解析器为表格内容解析器;然后,通过表格内容解析器读取元数据信息中的字段名称,基于字段名称生成对应的第一单元格标签,并将第一单元格标签嵌套在预设表头标签内。其中,第一单元格表格是基于字段名称和预设单元格标签(为<td>标签)生成的,预设表头标签为<th>标签,例如针对下表1中的表格,其字段名称包括name和score,可生成对应的第一单元格标签为<td>name</td>和<td>score</td>,将第一单元格标签嵌套在预设表头标签内之后,可得到如下结果:In this embodiment, the processing procedure of table data is introduced. The specific process is as follows: if the data type in the metadata information is a table, the corresponding target content parser is determined to be the table content parser; then, the field name in the metadata information is read through the table content parser, and the generated data is generated based on the field name The corresponding first cell label, and the first cell label is nested within the preset header label. Among them, the first cell table is generated based on the field name and the preset cell label (for the <td> tag), and the preset table header tag is the <th> tag. For example, for the table in Table 1 below, its field name Including name and score, the corresponding first cell tags can be generated as <td>name</td> and <td>score</td>, after nesting the first cell tag in the preset header tag, The following results can be obtained:
然后,根据结果集的值获取表格行数及表格各行内部各列的值,生成与表格行数相同数量的行标签,其中,行标签为<tr>标签;进而根据表格各行内部各列的值生成对应的第二单元格标签,并将第二单元格标签嵌套在对应的行标签内;最后,将嵌套后的预设表头标签内的文本与嵌套后的行标签内的文本进行合并,并嵌套至预设表格标签内,得到中间对象,其中,预设表格表内为<table>标签。例如上述例中,可得到中间对象如下:Then, obtain the number of table rows and the values of each column in each row of the table according to the value of the result set, and generate the same number of row labels as the number of table rows, where the row label is the <tr> tag; and then according to the value of each column in each row of the table Generate the corresponding second cell label, and nest the second cell label in the corresponding row label; finally, combine the text in the nested preset header label with the text in the nested row label Merge and nest into the preset table tag to obtain an intermediate object, wherein the preset table table is a <table> tag. For example, in the above example, the intermediate objects can be obtained as follows:
表1表格结果集Table 1 Tabular result set
进一步地,步骤S20还可以包括:Further, step S20 may also include:
步骤c41,若所述元数据信息中的数据类型为文件,则确定对应的目标内容解析器为文件内容解析器;Step c41, if the data type in the metadata information is a file, then determine that the corresponding target content parser is a file content parser;
步骤c42,通过所述文件内容解析器检测所述结果集的值为单行还是多行;Step c42, detecting whether the value of the result set is a single line or multiple lines by the file content parser;
步骤c43,若所述结果集的值为单行,则将所述结果集的值作为预设段落标签的内容,得到中间对象;Step c43, if the value of the result set is a single line, then the value of the result set is used as the content of the preset paragraph label to obtain an intermediate object;
步骤c44,若所述结果集的值为多行,则对所述结果集的值进行分行处理,基于分行处理结果、所述预设段落标签和预设换行标签,得到中间对象。Step c44, if the value of the result set has multiple lines, perform line-by-line processing on the value of the result set, and obtain an intermediate object based on the result of the line-by-line processing, the preset paragraph label and the preset line break label.
本实施例中介绍了文件类数据的处理过程。具体过程如下:若元数据信息中的数据类型为文件,则确定对应的目标内容解析器为文件内容解析器;然后,通过文件内容解析器检测结果集的值为单行还是多行;若结果集的值为单行,则将结果集的值直接作为预设段落标签的内容,得到中间对象,其中,预设段落标签可以为<p>标签;若结果集的值为多行,则对结果集的值进行分行处理,进而基于分行处理结果、预设段落标签和预设换行标签,得到中间对象。具体的,在进行分行处理时,可根据换行符(\n)对结果集的值进行分割,可分割得到多行文本,各行文本内容分别作为一预设段落标签的内容,得到多个段落标签,进而以预设换行标签(<br>标签)为间隔符对上述处理得到的多个段落标签进行合并,即可得到对应的中间对象。In this embodiment, the processing procedure of file type data is introduced. The specific process is as follows: if the data type in the metadata information is a file, the corresponding target content parser is determined as the file content parser; then, the value of the result set is detected by the file content parser or multi-line; The value of the result set is a single line, the value of the result set is directly used as the content of the preset paragraph label, and the intermediate object is obtained, where the preset paragraph label can be a <p> tag; if the value of the result set is multiple lines, the result set The value of , performs line branch processing, and then obtains an intermediate object based on the line branch processing result, the preset paragraph label, and the preset line break label. Specifically, when performing line break processing, the value of the result set can be divided according to the line break (\n), and multiple lines of text can be obtained by dividing the text content of each line as the content of a preset paragraph label, and multiple paragraph labels can be obtained. , and then use the preset newline tag (<br> tag) as a spacer to combine the plurality of paragraph tags obtained by the above processing, so as to obtain a corresponding intermediate object.
进一步地,步骤S20还可以包括:Further, step S20 may also include:
步骤c51,若所述元数据信息中的数据类型为链接,则确定对应的目标内容解析器为链接内容解析器;Step c51, if the data type in the metadata information is a link, then determine that the corresponding target content parser is a link content parser;
步骤c52,通过所述链接内容解析器检测所述结果集的值为单行还是多行;Step c52, detecting whether the value of the result set is single-line or multi-line by the link content parser;
步骤c53,若所述结果集的值为单行,则将所述结果集的值转换成第一超链接标签,并将所述邮件内容对应的结果集的文件名作为所述第一超链接标签的提示信息,得到中间对象;Step c53, if the value of the result set is a single line, then convert the value of the result set into a first hyperlink label, and use the file name of the result set corresponding to the content of the email as the first hyperlink label The prompt information to get the intermediate object;
步骤c54,若所述结果集的值为多行,则对所述结果集的值进行分行处理,将分行后的结果集的值分别转换成对应的第二超链接标签;Step c54, if the value of the result set is multiple rows, then the value of the result set is processed by branch, and the value of the result set after the branch is converted into the corresponding second hyperlink label respectively;
步骤c55,对所述第二超链接标签进行合并,并将所述邮件内容对应的结果集的文件名作为合并后的第二超链接标签的提示信息,得到中间对象。Step c55: Merge the second hyperlink labels, and use the filename of the result set corresponding to the content of the email as prompt information of the merged second hyperlink label to obtain an intermediate object.
本实施例中介绍了链接类数据的处理过程。具体过程如下:若元数据信息中的数据类型为链接(URL链接),则确定对应的目标内容解析器为链接内容解析器;然后,通过链接内容解析器检测结果集的值为单行还是多行。In this embodiment, the processing procedure of link class data is introduced. The specific process is as follows: if the data type in the metadata information is a link (URL link), the corresponding target content parser is determined as the link content parser; then, the value of the result set is detected by the link content parser as a single line or multiple lines .
若结果集的值为单行,则将结果集的值转换成第一超链接标签,并将邮件内容对应的结果集的文件名作为第一超链接标签的提示信息,得到中间对象。其中,第一超链接标签的生成过程为:根据将结果集的值直接作为预设超链接标签的href(HypertextReference,超文本引用)属性,其中,预设超链接标签可以为<a>标签。If the value of the result set is a single row, the value of the result set is converted into the first hyperlink label, and the file name of the result set corresponding to the email content is used as the prompt information of the first hyperlink label to obtain the intermediate object. The generation process of the first hyperlink label is as follows: the value of the result set is directly used as the href (HypertextReference, hypertext reference) attribute of the preset hyperlink label, wherein the preset hyperlink label may be an <a> label.
若结果集的值为多行,则对结果集的值进行分行处理,将分行后的结果集的值分别转换成对应的第二超链接标签,具体的,在进行分行处理时,可根据换行符(\n)对结果集的值进行分割,可分割得到多行文本,将各行文本内容分别作为一预设超链接标签的href属性,得到多个超链接标签。然后,对第二超链接标签进行合并,并将邮件内容对应的结果集的文件名作为合并后的第二超链接标签的提示信息,得到中间对象。If the value of the result set is multi-line, the value of the result set is processed by line, and the value of the result set after the branch is converted into the corresponding second hyperlink label. The value of the result set is divided by the character (\n), and multiple lines of text can be obtained by dividing the text content of each line as the href attribute of a preset hyperlink tag to obtain multiple hyperlink tags. Then, the second hyperlink labels are merged, and the file name of the result set corresponding to the content of the mail is used as the prompt information of the merged second hyperlink label to obtain an intermediate object.
本发明还提供一种邮件发送装置。The invention also provides a mail sending device.
参照图3,图3为本发明邮件发送装置第一实施例的功能模块示意图。Referring to FIG. 3 , FIG. 3 is a schematic diagram of functional modules of the first embodiment of the mail sending apparatus of the present invention.
如图3所示,所述邮件发送装置包括:As shown in Figure 3, the mail sending device includes:
获取模块10,用于在接收到邮件发送请求时,根据所述邮件发送请求获取邮件内容和邮件基本信息,所述邮件内容包括元数据信息和结果集的值;The obtaining
解析模块20,用于根据所述元数据信息中的数据类型确定对应的目标内容解析器,并通过所述目标内容解析器对所述结果集的值进行解析处理,得到中间对象;A parsing
合并模块30,用于按解析顺序对所述中间对象进行合并,并将合并后的中间对象插入预设结构中,得到邮件正文;The merging
发送模块40,用于基于所述基本信息对所述邮件正文进行发送。The sending
进一步地,所述获取模块10包括:Further, the
第一获取单元,用于在接收到邮件发送请求时,根据所述邮件发送请求获取作业编号ID、用户名和邮件基本信息;a first obtaining unit, configured to obtain the job number ID, user name and basic mail information according to the mail sending request when receiving the mail sending request;
第二获取单元,用于根据所述作业ID、所述用户名和预先配置的根目录生成结果集路径,并根据所述结果集路径获取邮件内容。The second obtaining unit is configured to generate a result set path according to the job ID, the user name and the preconfigured root directory, and obtain mail content according to the result set path.
进一步地,所述解析模块20包括第一解析单元,用于:Further, the parsing
若所述元数据信息中的数据类型为图片,则确定对应的目标内容解析器为图片内容解析器;If the data type in the metadata information is a picture, then determine that the corresponding target content parser is a picture content parser;
通过所述图片内容解析器从所述元数据信息中获取图片格式,并将所述结果集的值还原成与所述图片格式对应的图片数据;Obtain a picture format from the metadata information by using the picture content parser, and restore the value of the result set to picture data corresponding to the picture format;
调用预设构造函数对所述图片数据进行处理,得到处理对象;calling a preset constructor to process the image data to obtain a processing object;
基于所述处理对象和预设图片标签格式,生成对应的图片标签,并将所述图片标签作为中间对象。Based on the processing object and the preset picture label format, a corresponding picture label is generated, and the picture label is used as an intermediate object.
进一步地,所述解析模块20包括第二解析单元,用于:Further, the parsing
若所述元数据信息中的数据类型为超文本标记语言HTML,则确定对应的目标内容解析器为HTML内容解析器;If the data type in the metadata information is HTML, then determine that the corresponding target content parser is an HTML content parser;
通过所述HTML内容解析器校验所述结果集的值是否符合预设邮件HTML规范;Checking, by the HTML content parser, whether the value of the result set conforms to the preset mail HTML specification;
若符合,则从所述结果集的值中提取出正文体标签内的子HTML,并将所述子HTML作为中间对象。If it matches, extract the sub-HTML in the body tag from the value of the result set, and use the sub-HTML as an intermediate object.
进一步地,所述解析模块20包括第三解析单元,用于:Further, the parsing
若所述元数据信息中的数据类型为表格,则确定对应的目标内容解析器为表格内容解析器;If the data type in the metadata information is a table, then determine that the corresponding target content parser is a table content parser;
通过所述表格内容解析器读取所述元数据信息中的字段名称,基于所述字段名称生成对应的第一单元格标签,并将所述第一单元格标签嵌套在预设表头标签内;The field name in the metadata information is read by the table content parser, a corresponding first cell label is generated based on the field name, and the first cell label is nested in a preset header label Inside;
根据所述结果集的值获取表格行数及表格各行内部各列的值,生成与所述表格行数相同数量的行标签;Obtain the number of table rows and the value of each column in each row of the table according to the value of the result set, and generate the same number of row labels as the number of table rows;
根据所述表格各行内部各列的值生成对应的第二单元格标签,并将所述第二单元格标签嵌套在对应的行标签内;Generate a corresponding second cell label according to the value of each column in each row of the table, and nest the second cell label in the corresponding row label;
将嵌套后的预设表头标签内的文本与嵌套后的行标签内的文本进行合并,并嵌套至预设表格标签内,得到中间对象。The text in the nested preset header tag is merged with the text in the nested row tag, and nested into the preset table tag to obtain an intermediate object.
进一步地,所述解析模块20包括第四解析单元,用于:Further, the parsing
若所述元数据信息中的数据类型为文件,则确定对应的目标内容解析器为文件内容解析器;If the data type in the metadata information is a file, then determine that the corresponding target content parser is a file content parser;
通过所述文件内容解析器检测所述结果集的值为单行还是多行;Detect, by the file content parser, whether the value of the result set is a single line or multiple lines;
若所述结果集的值为单行,则将所述结果集的值作为预设段落标签的内容,得到中间对象;If the value of the result set is a single line, the value of the result set is used as the content of the preset paragraph label to obtain an intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,基于分行处理结果、所述预设段落标签和预设换行标签,得到中间对象。If the value of the result set has multiple lines, the value of the result set is processed by line, and an intermediate object is obtained based on the result of the line branch processing, the preset paragraph label and the preset line break label.
进一步地,所述解析模块20包括第五解析单元,用于:Further, the parsing
若所述元数据信息中的数据类型为链接,则确定对应的目标内容解析器为链接内容解析器;If the data type in the metadata information is a link, then determine that the corresponding target content parser is a link content parser;
通过所述链接内容解析器检测所述结果集的值为单行还是多行;Detecting whether the value of the result set is a single line or multiple lines by the link content parser;
若所述结果集的值为单行,则将所述结果集的值转换成第一超链接标签,并将所述邮件内容对应的结果集的文件名作为所述第一超链接标签的提示信息,得到中间对象;If the value of the result set is a single line, convert the value of the result set into a first hyperlink label, and use the file name of the result set corresponding to the content of the email as the prompt information of the first hyperlink label , get the intermediate object;
若所述结果集的值为多行,则对所述结果集的值进行分行处理,将分行后的结果集的值分别转换成对应的第二超链接标签;If the value of the result set is multi-row, then the value of the result set is processed by branch, and the value of the result set after the branch is converted into the corresponding second hyperlink label respectively;
对所述第二超链接标签进行合并,并将所述邮件内容对应的结果集的文件名作为合并后的第二超链接标签的提示信息,得到中间对象。The second hyperlink labels are merged, and the file name of the result set corresponding to the content of the email is used as the prompt information of the merged second hyperlink label to obtain an intermediate object.
进一步地,所述发送模块40包括:Further, the sending
创建单元,用于获取当前环境可支持的邮件客户端类型,并根据所述当前环境可支持的邮件客户端类型和预设映射关系创建对应类型的邮件对象;The creating unit is used to obtain the email client type supported by the current environment, and create a corresponding type of email object according to the email client type supported by the current environment and the preset mapping relationship;
发送单元,用于将所述邮件正文和所述邮件基本信息填充至所述邮件对象中,并将填充后的邮件对象提交至预设邮件客户端进行发送。A sending unit, configured to fill the email body and the basic information of the email into the email object, and submit the filled email object to a preset email client for sending.
其中,上述邮件发送装置中各个模块的功能实现与上述邮件发送方法实施例中各步骤相对应,其功能和实现过程在此处不再一一赘述。The function implementation of each module in the above-mentioned mail sending apparatus corresponds to each step in the above-mentioned embodiment of the mail sending method, and the functions and implementation processes thereof will not be repeated here.
本发明还提供一种计算机可读存储介质,该计算机可读存储介质上存储有邮件发送程序,所述邮件发送程序被处理器执行时实现如以上任一项实施例所述的邮件发送方法的步骤。The present invention also provides a computer-readable storage medium, on which a mail sending program is stored, and when the mail sending program is executed by a processor, the mail sending method according to any one of the above embodiments is implemented. step.
本发明计算机可读存储介质的具体实施例与上述邮件发送方法各实施例基本相同,在此不作赘述。The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the above-mentioned embodiments of the mail sending method, and are not repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or system comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or system. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article or system that includes the element.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on such understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM) as described above. , magnetic disk, optical disk), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present invention.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields , are similarly included in the scope of patent protection of the present invention.
Claims (11)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911103307.3A CN110855555B (en) | 2019-11-12 | 2019-11-12 | Email sending method, device, equipment and computer-readable storage medium |
| PCT/CN2020/126825 WO2021093673A1 (en) | 2019-11-12 | 2020-11-05 | E-mail sending method, apparatus and device, and computer-readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911103307.3A CN110855555B (en) | 2019-11-12 | 2019-11-12 | Email sending method, device, equipment and computer-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110855555A true CN110855555A (en) | 2020-02-28 |
| CN110855555B CN110855555B (en) | 2023-04-07 |
Family
ID=69601484
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911103307.3A Active CN110855555B (en) | 2019-11-12 | 2019-11-12 | Email sending method, device, equipment and computer-readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110855555B (en) |
| WO (1) | WO2021093673A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2021093673A1 (en) * | 2019-11-12 | 2021-05-20 | 深圳前海微众银行股份有限公司 | E-mail sending method, apparatus and device, and computer-readable storage medium |
| CN114676124A (en) * | 2022-05-27 | 2022-06-28 | 航天信息(广东)有限公司 | Data field difference solving method, device, equipment and medium based on configuration |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115499405B (en) * | 2022-09-14 | 2024-04-30 | 天翼数字生活科技有限公司 | Method and system for custom generation of mail |
| CN116938610B (en) * | 2023-09-19 | 2023-11-17 | 北京傲星科技有限公司 | Mail system based on mimicry architecture |
| CN117692235B (en) * | 2023-12-20 | 2024-11-26 | 茂佳科技(广东)有限公司 | Data download method, device, terminal equipment and storage medium |
| CN117478670B (en) * | 2023-12-28 | 2024-04-26 | 彩讯科技股份有限公司 | Exchange data migration method, system and medium based on pst file protocol analysis |
| CN118170462B (en) * | 2024-05-14 | 2024-07-12 | 北京国专知识产权有限责任公司 | Mail sending method and device for case management system |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2014170447A (en) * | 2013-03-05 | 2014-09-18 | Nec Corp | Mail file management device, method, and program |
| CN106713109A (en) * | 2015-11-13 | 2017-05-24 | 北京奇虎科技有限公司 | Html mail sending and receiving method and device |
| CN109039876A (en) * | 2018-09-19 | 2018-12-18 | 天津字节跳动科技有限公司 | Email processing method and device |
| CN109995643A (en) * | 2017-12-29 | 2019-07-09 | 中国移动通信集团河南有限公司 | Business mail push method and device |
| CN110223044A (en) * | 2019-06-12 | 2019-09-10 | 深圳市网心科技有限公司 | A kind of mail push method, system and electronic equipment and storage medium |
| CN110351182A (en) * | 2019-05-31 | 2019-10-18 | 平安科技(深圳)有限公司 | E-mail sending method, device, equipment and computer readable storage medium |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101841514A (en) * | 2009-03-17 | 2010-09-22 | 联想(北京)有限公司 | Mail handing method and device |
| US9836724B2 (en) * | 2010-04-23 | 2017-12-05 | Microsoft Technology Licensing, Llc | Email views |
| CN109902113B (en) * | 2019-01-17 | 2024-04-02 | 平安科技(深圳)有限公司 | Credit feedback report processing method and device, storage medium and computer equipment |
| CN110855555B (en) * | 2019-11-12 | 2023-04-07 | 深圳前海微众银行股份有限公司 | Email sending method, device, equipment and computer-readable storage medium |
-
2019
- 2019-11-12 CN CN201911103307.3A patent/CN110855555B/en active Active
-
2020
- 2020-11-05 WO PCT/CN2020/126825 patent/WO2021093673A1/en not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2014170447A (en) * | 2013-03-05 | 2014-09-18 | Nec Corp | Mail file management device, method, and program |
| CN106713109A (en) * | 2015-11-13 | 2017-05-24 | 北京奇虎科技有限公司 | Html mail sending and receiving method and device |
| CN109995643A (en) * | 2017-12-29 | 2019-07-09 | 中国移动通信集团河南有限公司 | Business mail push method and device |
| CN109039876A (en) * | 2018-09-19 | 2018-12-18 | 天津字节跳动科技有限公司 | Email processing method and device |
| CN110351182A (en) * | 2019-05-31 | 2019-10-18 | 平安科技(深圳)有限公司 | E-mail sending method, device, equipment and computer readable storage medium |
| CN110223044A (en) * | 2019-06-12 | 2019-09-10 | 深圳市网心科技有限公司 | A kind of mail push method, system and electronic equipment and storage medium |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2021093673A1 (en) * | 2019-11-12 | 2021-05-20 | 深圳前海微众银行股份有限公司 | E-mail sending method, apparatus and device, and computer-readable storage medium |
| CN114676124A (en) * | 2022-05-27 | 2022-06-28 | 航天信息(广东)有限公司 | Data field difference solving method, device, equipment and medium based on configuration |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110855555B (en) | 2023-04-07 |
| WO2021093673A1 (en) | 2021-05-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110855555B (en) | Email sending method, device, equipment and computer-readable storage medium | |
| US8185591B1 (en) | Systems and methods for viewing email attachments as thumbnails | |
| US9021035B2 (en) | Formatting rich text data into a JSON array | |
| AU2011341505B2 (en) | Using text messages to interact with spreadsheets | |
| US20110185024A1 (en) | Embeddable metadata in electronic mail messages | |
| US8346878B2 (en) | Flagging resource pointers depending on user environment | |
| US8943144B2 (en) | Consolidating duplicate messages for a single destination on a computer network | |
| CN110941950B (en) | Interface document generation method, device, server and storage medium | |
| US8825756B2 (en) | Server apparatus, information processing method, information processing program, and recording medium | |
| CN108737252B (en) | Information pushing method and device based on block chain | |
| CN112947900B (en) | Web application development method and device, server and development terminal | |
| CN113382083B (en) | Webpage screenshot method and device | |
| US8775520B1 (en) | Systems and methods for viewing non-HTML email attachments | |
| CN112311654A (en) | Instant messaging message processing method, device, medium and electronic equipment | |
| CA3061623C (en) | File sending in instant messaging applications | |
| CN112286815A (en) | Interface test script generation method and related equipment thereof | |
| US20120166554A1 (en) | Automatically compressing e-mail forwarded to a user telephone | |
| TW200524381A (en) | Multi-language wireless email transmission method for mobile communication | |
| CN101771928A (en) | Method and system and proxy server for Webpage transmitting | |
| CN117291151A (en) | Method, device, computer readable medium and equipment for controlling conversion of document format | |
| US20140222865A1 (en) | Method, System and Program for Interactive Information Services | |
| CN118708552A (en) | A method, device and computing equipment for extracting thumbnails of layout files | |
| WO2010105521A1 (en) | Method for mail processing and device thereof | |
| US20210273900A1 (en) | Methods and systems for processing electronic messages | |
| CN107508705B (en) | Resource tree construction method of HTTP element and computing equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |