Mail sending method and device, equipment, storage medium and program product
By analyzing and processing initial mail based on SMTP, generating mail in the target format and sending it, the problem of insufficient mail transmission efficiency and compatibility in the prior art is solved, and higher compatibility and user experience are achieved.
Patent Information
- Application Number
- CN202411876378.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-11
AI Technical Summary
Existing email sending technologies have shortcomings in improving user sending efficiency and experience, especially when dealing with multiple types and types of mail content, where compatibility and compatibility are insufficient.
By parsing the initial mail based on Simple Mail Transfer Protocol (SMTP), identify the instruction content part and execute the corresponding instructions, combine the non-instruction content part and the execution result, a target email in the target format is generated and sent to the specified target address.
The compatibility improvement of mail sent based on SMTP is achieved, so that more types and types of content can be attached to emails, meet diversified communication needs, and improve the compatibility and user experience of message transmission.
Smart Images

Figure CN119814719A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology such as information transmission, communication technology, and data processing, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for sending emails. Background Art
[0002] With the development of computer technology, email is widely used by users as a means of information communication. Through the email system of the network, users can quickly and efficiently complete information communication with other users at a very low communication cost.
[0003] The email-based communication method is usually implemented according to the following process: the user completes the writing of the email on the terminal device used by the user; the user provides the completed email to the corresponding mailbox server through the terminal device; after receiving the email, the mailbox server can transmit it to the mailbox server corresponding to the target address based on the target address indicated therein, so as to realize and complete the sending of the email.
[0004] In this context, how to improve users' email sending efficiency and enhance their email sending experience is worthy of attention and an urgent need. Summary of the invention
[0005] The embodiments of the present disclosure provide a method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for sending an email.
[0006] In a first aspect, an embodiment of the present disclosure proposes a method for sending an email, comprising: parsing an initial email to obtain the email content of the initial email, wherein the initial email is transmitted based on a simple mail transfer protocol; in response to an instruction content portion included in the email content, executing the to-be-executed instructions corresponding to the instruction content portion to obtain an execution result; based on a non-instruction content portion of the email content and the execution result, generating a target email in a target format; and sending the target email to a target address indicated in the non-instruction content portion.
[0007] In the second aspect, an embodiment of the present disclosure proposes a device for sending an email, comprising: an initial email parsing unit, configured to parse the initial email to obtain the email content of the initial email, wherein the initial email is transmitted based on the Simple Mail Transfer Protocol; an instruction content execution unit, configured to execute the to-be-executed instructions corresponding to the instruction content part in response to the email content including the instruction content part, and obtain the execution result; a first email generating unit, configured to generate a target email in a target format based on the non-instruction content part of the email content and the execution result; and a target email sending unit, configured to send the target email to the target address indicated in the non-instruction content part.
[0008] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that when the at least one processor executes, it is able to implement the method for sending an email as described in any implementation method in the first aspect.
[0009] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the method of sending an email as described in any implementation manner in the first aspect when executed.
[0010] In a fifth aspect, an embodiment of the present disclosure provides a computer program product including a computer program, which, when executed by a processor, can implement the method for sending an email as described in any implementation manner in the first aspect.
[0011] The embodiments of the present disclosure provide a method, device, electronic device, computer-readable storage medium, and computer program product for sending emails, which parse an initial email to obtain the email content of the initial email, wherein the initial email is transmitted based on a simple mail transfer protocol; in response to an instruction content portion included in the email content, execute instructions to be executed corresponding to the instruction content portion to obtain an execution result; based on the non-instruction content portion of the email content and the execution result, generate a target email in a target format; and send the target email to a target address indicated in the non-instruction content portion.
[0012] The present disclosure enables emails sent based on the Simple Mail Transfer Protocol to be attached with more types and more kinds of email content, which can improve the compatibility of message transmission and meet different and diversified communication needs.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0015] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;
[0016] Figure 2 A flowchart of a process of sending an email provided by an embodiment of the present disclosure;
[0017] Figure 3 A flowchart of a process of obtaining email content provided by an embodiment of the present disclosure;
[0018] Figure 4 A schematic diagram of an architecture for implementing a process of sending an email in an application scenario provided by an embodiment of the present disclosure;
[0019] Figure 5 A structural block diagram of a device for sending emails provided in an embodiment of the present disclosure;
[0020] Figure 6 A schematic diagram of the structure of an electronic device suitable for executing a method for sending an email provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.
[0022] In addition, in the technical solutions involved in this disclosure, the acquisition, storage, use, processing, transportation, provision and disclosure of user personal information involved are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0023] For example, when the initial email is sent by the user, the user is aware of and permitted to parse the email content of the initial email. For example, the user may know and permit the parsing of the email content of the initial email sent by the user through pre-authorization or the like.
[0024] Figure 1An exemplary system architecture 100 is shown to which embodiments of the method, apparatus, electronic device, and computer-readable storage medium for sending emails disclosed in the present invention can be applied.
[0025] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, a network 103, a server 104, and a server 105. The network 103 may be used to provide a medium for communication links between the terminal devices 101, 102, the server 104, and the server 105. The network 103 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0026] Exemplarily, the server 104 can be understood as a corresponding "mail server" associated with the terminal device 101. For example, the server 104 can be used to receive (electronic) emails sent by the terminal device 101 and send them according to the instructions of the terminal device 101. In addition, the server 104 can also receive emails sent to the terminal device 101, and send and provide them to the terminal device 101.
[0027] Similarly, the server 105 can be exemplified as a corresponding “mailbox server” associated with the terminal device 102 .
[0028] Accordingly, in such a context, when the user of the terminal device 101 wishes to send an (electronic) email to the user of the terminal device 102, the email can be delivered in sequence through the communication link of the terminal device 101-server 104-server 105-terminal device 102. Accordingly, the user of the terminal device 102 can read the email by using the terminal device 102.
[0029] Accordingly, an application for realizing "email" communication can be installed between the terminal device and the corresponding server. Taking the terminal device 101 and the corresponding server 104 as an example, various applications for realizing information communication between the two can be installed between the two, such as e-mail applications, instant messaging applications, etc.
[0030] Terminal device 101, terminal device 102, server 104 and server 105 can be hardware or software. When terminal devices 101 and 102 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 101 and 102 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here. When servers 104 and 105 are hardware, they can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.
[0031] The server 104 can provide various services through various built-in applications. Taking the email application that can provide email communication services as an example, the server 104 can achieve the following effects when running the email application: first, the initial email transmitted based on the Simple Mail Transfer Protocol (SMTP) is obtained from the terminal device 101 through the network 103; then, the server 104 parses the initial email to obtain the email content of the initial email; next, if the email content includes an instruction content part, the server 104 responds to this and executes the to-be-executed instructions corresponding to the instruction content part to obtain the execution result; next, the server 104 generates a target email in a target format based on the non-instruction content part of the email content and the execution result; finally, the server 104 sends the target email to the target address indicated in the non-instruction content part.
[0032] Since parsing the mail and generating the target mail in the target format may often require more computing resources and stronger computing power, the mail sending method provided in the subsequent embodiments of the present disclosure is generally performed by the server 104 with stronger computing power and more computing resources, and accordingly, the mail sending device is generally also set in the server 104. However, it should also be pointed out that when the terminal device 101 also has computing power and computing resources that meet the requirements, the terminal device 101 can also complete the above-mentioned various operations that are handed over to the server 104 through the e-mail application installed thereon, and then output the same result as the server 104. Especially in the case where there are multiple terminal devices with different computing powers at the same time, but the e-mail application determines that the terminal device has stronger computing power and more remaining computing resources, it can let the terminal device perform the above-mentioned operations, thereby appropriately reducing the computing pressure of the server 104, and accordingly, the mail sending device can also be set in the terminal device 101. Similarly, for the combination of the terminal device 102 and the server 105, the above-mentioned configuration method can also be implemented in a similar manner, and it will not be repeated here.
[0033] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0034] Please refer to Figure 2 , Figure 2 A flowchart of a method for sending an email provided in an embodiment of the present disclosure, wherein process 200 includes the following steps:
[0035] Step 201: Parse the initial email to obtain the email content of the initial email;
[0036] In the embodiment of the present disclosure, this step is intended to be performed by the execution subject of the method of sending an email (for example Figure 1 After obtaining the initial email (for example, the initial email is sent by the terminal device 101), the server 104 parses the content of the initial email.
[0037] The terminal device 101 and the server 104 can communicate via SMTP, that is, the initial email is transmitted based on SMTP (Simple Mail Transfer Protocol).
[0038] SMTP is a standard communication protocol for transmitting (electronic) emails in computer networks. The main function of SMTP is to ensure that emails are transmitted from the sender's email client to the recipient's email server through the email server, and finally received by the recipient's email client. SMTP is a push protocol that is specifically used for sending emails and does not involve the reception and storage of emails.
[0039] For example, the user can use the terminal device 101 to communicate with the execution subject based on SMTP to send the initial email. For example, the user can write and send such an initial email to the execution subject through, for example, an email application configured in the terminal device 101, so that the execution subject can send the initial email to a target address and a target device (for example, the target address can be an address in the server 105 pointing to the terminal device 102).
[0040] For example, in an exemplary scenario, the executing entity may be, for example, the enterprise's mail management server (which can manage mails for multiple terminal devices at the same time and provide a "mailbox server"), which can receive the initial mails sent by terminal devices within the enterprise and on the enterprise network via SMTP, and then, directly or based on certain processing strategies, send the initial mails or processed initial mails to the target address indicated by the initial mails.
[0041] Generally, the parsed email content can be divided into instruction content and non-instruction content based on different types. The instruction content can correspond to an action code with an action execution function.
[0042] Accordingly, the user can provide instruction content by adding action codes in the email to instruct the execution subject to perform corresponding actions based on the instruction content.
[0043] For example, the instruction content can be a piece of action code that can be executed to achieve a function or purpose. For example, when the function is to obtain an image, the instruction content can be to perform an operation of extracting a file from the XX address, and the "file" is actually the storage file of the "image". Similarly, the instruction content can also be used to instruct the acquisition of video or audio files, or to perform operations (for example, encrypting the content of the email that is not the instruction content).
[0044] Here, the function of "get, add image (file)" is used as an example. Accordingly, for example, when a user wishes to add an image to an initial email, he can instruct the execution subject to execute the action code to get the corresponding image by including such an action code in the initial email.
[0045] The non-instruction content may be, for example, the email content included in the initial email, such as the recipient address (and the recipients to whom the email is copied) as the target address, the text in the email, the email sending time, etc. These non-instruction contents often only need to be used, provided, and sent in their original form, and do not need to be, or are not expected by the user to be, "executed" by the execution subject.
[0046] Step 202: In response to the email content including the instruction content part, executing the to-be-executed instruction corresponding to the instruction content part, and obtaining an execution result;
[0047] In an embodiment of the present disclosure, after the initial email is parsed based on the above step 201 to obtain the email content, if the email content includes an instruction content part (i.e., the part including the instruction content), the execution subject can choose to execute the to-be-executed instructions corresponding to the instruction content part (i.e., the corresponding action code) to obtain the execution result.
[0048] For example, as discussed above, if the email content includes an instruction content portion of "obtain image (file)", the execution subject can execute the to-be-executed instruction corresponding to the instruction content portion to obtain the corresponding "image (file)".
[0049] Step 203: Generate a target email in a target format based on the non-command content portion of the email content and the execution result;
[0050] In an embodiment of the present disclosure, after obtaining the execution result based on the above step 202, the execution subject may choose to obtain the target email that is finally sent based on the non-instruction part in the email content and the instruction result.
[0051] The target format of the target email is often different from SMTP (or in other words, it is not a format corresponding to or supported by SMTP). As a result, the target email in the target format can include content such as images, audio, and video that cannot be supported and presented by SMTP.
[0052] In some optional implementations of this embodiment, in order to improve the compatibility of the target email, the target format may be Multipurpose Internet Mail Extensions format.
[0053] The Multipurpose Internet Mail Extensions (MIME) format is a standard for (electronic) email transmission. MIME can be used to extend email protocols such as SMTP, which originally could only transmit plain text, so that emails can support content in multiple formats, such as text, images, audio, video, attachments, etc.
[0054] Correspondingly, the execution subject can process the non-instruction part of the email content through the MIME format to form the corresponding content in the target email.
[0055] For example, for the following data: transmission time, email title, email content text, sender address, recipient address, CC address, etc., the execution subject can directly process these contents into the contents of the target email in MIME format.
[0056] Furthermore, for the above-mentioned "execution result", the execution subject can also add it to the target email in MIME format accordingly.
[0057] In other words, the target email in the target format generated by the execution subject includes the email content of the non-instruction content part of the original initial email and the execution result obtained by executing the to-be-executed instruction.
[0058] Thus, in this way, users can provide and add content such as images, videos, audios, etc. that cannot be transmitted by SMTP in the form of "get action" in the emails communicated by SMTP (i.e., the initial email described above). At the same time, this method also allows users to configure the content in the target email in the form of "instructions to be executed" (for example, instructing the execution subject to perform "processing" through the indicated operation to obtain the target email desired by the user).
[0059] Step 204: Send the target email to the target address indicated in the non-instruction content part.
[0060] In an embodiment of the present disclosure, after obtaining the target email based on the above step 203, the execution subject can send the target email based on the target address indicated in the non-instruction content part (ie, send the target email to the target address).
[0061] When sending, the execution subject can implement the sending of the target email based on the transmission protocol corresponding to the target address and allowing communication. The communication protocol corresponding to the target address can usually support the presentation of the entire content of the target email. For example, the communication protocol can be a pre-configured and maintained WebSocket protocol, etc.
[0062] For example, combined with Figure 1In the illustrated system architecture 100, the target address may be the address of the terminal device 102 corresponding to the server 105. Accordingly, the execution subject may communicate with the server 105 based on the WebSocket protocol with the target email in the target format to complete the sending of the target email. For example, the execution subject sends the target email to the server 105 based on the WebSocket protocol (for example, calling the email interface of the corresponding channel, for example, the email interface may also be provided in the initial email in the form of "non-instruction content"), so that the terminal device 102 may subsequently obtain the target email by accessing the server 105 or being sent by the server 105.
[0063] As further discussed above, the execution subject may maintain communication protocols corresponding to different target addresses (e.g., the server actually corresponding to the target address) for different target addresses. As a result, the subsequent execution subject can choose to complete the sending based on the communication protocol corresponding to the target address during the execution of this step. In some scenarios, the execution subject can achieve the purpose of maintaining the protocol by maintaining a sending port. For example, the execution subject can achieve the purpose of sending the target email based on the protocol for the target address configured by the sending port by calling the sending port.
[0064] Therefore, this method allows the email sender to "extend SMTP" through the execution entity even if there is no corresponding configuration of the target address, such as the WebSocket protocol (that is, even if the user communicates with the execution entity based on SMTP, he or she can still provide email content "not directly supported by SMTP" such as images, videos, audio, etc. in the initial email) to complete the sending of the complete email content.
[0065] It should be understood that the execution subject can usually determine the protocol to be used based on the target address indicated therein after parsing the non-instruction content portion. In such a case, the execution subject can refer to the protocol in the process of generating the target email, and generate the target email based on the corresponding target format configured by the protocol. In this way, it is ensured that the communication of the target email can be supported by the protocol.
[0066] Accordingly, this allows the initial email provider to still be able to send content such as images and videos based on SMTP with the execution entity, which can also reduce the protocol configuration requirements between the provider and the execution entity (that is, it is not necessary to configure, for example, the WebSocket protocol between the execution entity and the provider of the initial email, and to provide emails in MIMT format in order to realize the need to send images and videos in emails).
[0067] The method for sending an email provided by the embodiment of the present disclosure parses an initial email to obtain the email content of the initial email, wherein the initial email is transmitted based on the Simple Mail Transfer Protocol; in response to the instruction content part included in the email content, executes the to-be-executed instruction corresponding to the instruction content part to obtain the execution result; based on the non-instruction content part of the email content and the execution result, generates a target email in a target format; and sends the target email to the target address indicated in the non-instruction content part. As a result, the emails sent based on the Simple Mail Transfer Protocol can also be attached with more types and more kinds of email content, which can improve the compatibility of message transmission and meet different and diversified communication needs.
[0068] Please refer to Figure 3 , Figure 3 A flowchart of a process of obtaining email content provided by an embodiment of the present disclosure includes process 300. For example, process 300 can be implemented as an alternative or substitute for step 201 above.
[0069] The process 300 specifically includes the following steps:
[0070] Step 301: Determine the line terminator included in the code data of the initial email;
[0071] Specifically, after obtaining the initial email, the execution subject can read the code data of the initial email and determine the line endings (Line Endings) included in the code data of the initial email. The line ending is a control character or character sequence used to identify the end position of a line. For example, the line ending can be the position of a carriage return line feed (CRLF).
[0072] Step 302: Segment the email content units based on the line ending characters;
[0073] Specifically, after determining each line terminator based on the above step 301, the execution subject may determine “each line content” included in the code data based on the line terminator.
[0074] Then, the execution subject may segment the email content units based on the email contents belonging to the same type (for example, all belonging to the recipient address, all belonging to the email title, etc.).
[0075] For example, in the MIME format, the execution body can be divided into email content units by boundary separation.
[0076] Boundary is a special string used to separate different parts. Boundary identifiers ensure that the parts are not confused and can be parsed correctly. The content of each part is included between the start and end of this boundary identifier. Accordingly, the code data represented between the start and end of the boundary identifier can be considered as a unit of email content.
[0077] Step 303: based on the matching result between the fields included in each email content unit and the preset fields, the sub-email content corresponding to each email content unit is obtained.
[0078] Specifically, after the execution subject determines each email content unit based on the above step 302, the execution subject may match the fields included in each email content unit with a preset field (eg, a field that can be used in advance to determine the type of the email content).
[0079] Then, the execution subject determines the type of the email content corresponding to the preset field as the parsing result corresponding to the email content unit (ie, the sub-mail content corresponding to the email content unit) based on the preset field hit in the matching result.
[0080] For example, the parsing result may indicate the instruction content portion corresponding to the email content unit, or which specific non-instruction content portion (for example, the recipient address) the email content unit corresponds to.
[0081] In some optional implementations of this embodiment, if the subsequent target format is MIME format, the execution subject can also parse the initial email based on the MIME format standard when parsing the initial email. Accordingly, because the Content-Type header in the MIME format usually specifies the type of email content in the corresponding email content unit, the execution subject can also choose to determine the sub-email content corresponding to each email content unit based on the content of the Content-Type header.
[0082] It should be understood that after determining the content of each sub-email, the execution subject has actually completed the parsing of the initial email and obtained the email content of the initial email. Because the email content is actually directly composed of the content of each sub-email, after determining the content of each sub-email, it is actually equivalent to completely determining the email content.
[0083] In other words, the email content is actually composed of the content type corresponding to each sub-email content and the "code data" under each sub-email content. After determining the code data corresponding to and associated with each sub-email content and the content type corresponding to each sub-email content (for example, instruction content or non-instruction content), the parsing of the initial email has been actually completed, and the email content of the initial email has been obtained.
[0084] Therefore, by dividing the "email content units" and determining the "boundaries", we can avoid overlap and confusion between different email contents, which can more accurately parse the email content.
[0085] In some embodiments, when the email content includes an instruction content portion, the execution subject may choose to execute the to-be-executed instruction corresponding to the instruction content portion to obtain an execution result.
[0086] In such a process, when the execution subject determines that the content of the email includes the instruction content part and responds to the situation, it first chooses to parse the instruction content part through regular expressions or state machine models to obtain action codes and action parameters. The state machine model is a mathematical model that can be used to identify the changes and behaviors expected to be executed.
[0087] Accordingly, some standard action codes (i.e., codes that can be used to instruct the execution of "actions") can be selected and maintained in advance, and then after the execution subject determines the content of the instruction part, the execution subject can compare these standard action codes with the content of the instruction part by means of regular expressions, or, using a state machine model, use these standard action codes as a reference to extract the action code corresponding to the "action" in the content of the instruction part.
[0088] Furthermore, after determining the "action code", the execution subject may extract the remaining portion after the action code from the instruction content as an action parameter.
[0089] For example, in the example where the purpose of the instruction content is to "obtain an image from XX", the action code may be "extract, obtain action", and accordingly, the action parameter may be "XX" which is reflected as a storage address, for example, the "XX" may be a Uniform Resource Locator (URL for short).
[0090] Then, the execution subject can execute the action code accordingly according to the action parameters to obtain the execution result.
[0091] Therefore, by using regular expressions and state machine models, the action code and action parameters in the instruction content can be more accurately and strictly distinguished, so that the desired "action" and the content and parameters pointed to by the "action" can be more accurately identified, so as to avoid action errors caused by inaccurate identification. In this way, the accuracy of identifying and executing the instructions to be executed can be improved.
[0092] In some embodiments, when a user is editing an initial email, in order to facilitate editing and provide "actions" for the user, the user may also indicate the action code and action parameters by adding, for example, an identification field (eg, "Act").
[0093] Similarly, the execution entity may also provide the user with these standard actions according to the user's request, so that the user can edit the initial email by referring to these standard actions.
[0094] Furthermore, based on different needs, the target email may also similarly include non-instruction content and content other than the execution result, in the hope of providing a reference for the user receiving the target email and improving the user's information acquisition efficiency.
[0095] In some optional implementations of this embodiment, if the execution result is an attachment file (for example, an image file), the execution subject may also choose to further generate a corresponding preview image corresponding to the attachment file.
[0096] Then, when executing step 203 and generating a target email in a target format, the execution subject may, as an alternative or substitute, choose to generate a target email in a target format based on the non-instruction content portion of the email content, the execution result and the preview image.
[0097] That is, the execution subject further adds the "preview image" to the target email during the process of generating the target email, so that the subsequent target email recipient can read the content in the target email more efficiently based on the preview image.
[0098] In some optional implementations of this embodiment, for attachment files, the content in the corresponding preview images may also be different based on their different forms. For example, for an attachment file of an image file, its "content" may be the image content. For another example, for an attachment file of a video file, its "content" may be the cover content of the video.
[0099] In some scenarios, such as for video, audio and other content, the "preview picture" may also provide summary information corresponding to the video content and audio content (for example, after generating a picture based on the summary information, it is added to the target email as a preview picture).
[0100] In some embodiments, during the process of executing step 203 to generate a target email in a target format, the execution subject may further choose to generate a target email in a target format according to a non-instruction content portion, an instruction content portion and an execution result.
[0101] That is, the execution subject can choose to generate a target email in a target format with the non-instruction content part, the instruction content part and the execution result as an alternative or replacement of step 203. This allows the instruction content part to be simultaneously presented in the target email.
[0102] Thus, different and differentiated usage requirements of users can be met by presenting the instruction content part. For example, users can quickly edit subsequent emails or obtain "action parameters" of URLs by modifying and adjusting the instruction content part.
[0103] In some embodiments, if the email content does not contain the instruction content part, the execution subject can also directly generate the target email in the target format based on the email content in the manner discussed above, that is, adjust the email under the SMTP protocol to the target email in the target format and send it.
[0104] Therefore, in this way, the initial email under the SMTP protocol can be adjusted to a target email in a target format with greater compatibility and adaptability. This allows the subsequent email recipient to use the target email in the target format to perform operations such as secondary editing and forwarding, which can improve the subsequent email flow efficiency.
[0105] In some embodiments, parsing errors may also occur during the parsing process of the email content of the initial email (for example, due to a writing error in the code data in the initial email, there is code data that cannot be recognized by the execution subject).
[0106] Accordingly, if a parsing error occurs in the process of parsing the initial email to obtain the email content (for example, part of the code data cannot be recognized, and the "action" corresponding to the recognized code data cannot be actually implemented due to incorrect action parameters), the execution entity can respond to this and generate an error message corresponding to the Simple Mail Transfer Protocol.
[0107] That is, if a parsing error occurs, the execution entity may determine the error message based on the specific cause of the error (for example, the content of the error message may be descriptive information indicating "code data" that cannot be recognized).
[0108] It should be understood that the error message should be information that can be sent completely by the Simple Mail Transfer Protocol (for example, the error message is "plain text").
[0109] Then, the execution entity may choose to send an error message to the provider of the initial email based on the Simple Mail Transfer Protocol to indicate that "an error exists" to the provider of the initial email and provide feedback to the provider.
[0110] Thus, the error information execution subject can synchronize the error information to the provider of the initial email when an error occurs during parsing, so as to request and instruct the provider of the initial email to update and correct the initial email, rather than mistakenly processing and sending the initial email. Thus, not only can the provider of the initial email efficiently complete the error correction, but also the waste of resources and the trouble of the recipient caused by the error sending can be avoided.
[0111] In some embodiments, the execution entity may also maintain an error code for a common error type, so as to indicate the existing error type through the error code.
[0112] In some embodiments, for the sake of communication efficiency, the executing entity may actually choose to provide error information through images, videos, etc. In such a case, the executing entity may also similarly edit the executable action code and action parameters and return the executable action code (or URL) to the provider of the initial email in the form of "text".
[0113] For example, the execution subject may store the image in a URL and return the URL to the provider of the initial email (or return the action code for obtaining the image from the URL to the provider of the initial email).
[0114] Accordingly, after obtaining the code to be acted upon, the execution subject can obtain the "image", "video" and the like returned by the execution subject using SMTP by executing the code locally or clicking on the URL.
[0115] Based on any of the above embodiments, in order to further improve the compatibility of the target email, when the execution entity sends the target email (for example, when executing step 204), the execution entity may, as an alternative or alternative, send the target email to the target address indicated in the non-instruction content part via the Hypertext Transfer Protocol.
[0116] Hypertext Transfer Protocol (HTTP) is a protocol used to transfer web pages and other resources on the Internet. It is the basic protocol for data exchange between the Web and browsers, and defines the rules for communication between clients (usually web browsers) and servers. HTTP is an application layer protocol, which is based on a request / response model, allowing clients to request resources on the server and the server to return the corresponding data.
[0117] Therefore, by utilizing the characteristics of HTTP, the target email can be sent to the target address accurately and without data loss, and the target email can be sent and communicated between the browser and the Web server, providing users with a more efficient, convenient, and multi-scenario email sending experience.
[0118] To deepen understanding, the present disclosure also provides a specific implementation scheme for the process of sending emails provided by the embodiment of the present disclosure in combination with a specific application scenario.
[0119] For this, please refer to Figure 4 . Figure 4 An embodiment of the present disclosure provides an architecture diagram of an exemplary architecture for implementing a process of sending an email, which includes architecture 400 .
[0120] For ease of understanding, we will also refer to Figure 1 A system architecture 100 is shown for illustration.
[0121] In the architecture 400 , the terminal device 101 can communicate with its corresponding server 104 which is a mailbox server via “SMTP”.
[0122] As for the server 104, it can communicate with the "mail server" of other terminal devices via HTTP. For example, the server 104 can communicate with the "mail server" of other terminal devices. Figure 4 The mailbox server 105 of the terminal device 102 directly shown in the figure communicates via HTTP.
[0123] In the architecture 400 , the terminal device 101 may execute S401 based on SMTP to send an initial email 410 to the server 104 .
[0124] The initial email 410 may include an instruction content portion 411 and non-instruction portions 412-414.
[0125] Then, after receiving the initial email 410, the server 104 can parse the initial email 410 to determine the instruction content part 411 and the non-instruction parts 412-414. Then, in response to parsing the instruction content part 411, the server 104 executes S402 to execute the execution instruction corresponding to the instruction content part 411 and obtain the execution result 421 (for example, the execution instruction actually obtains an image file from a specific URL).
[0126] Next, the server 104 continues to execute S403 to generate a target mail 430 in a target format based on the non-instruction parts 412 - 414 and the execution result 421 .
[0127] Finally, the server 104 may execute S404 to send the target mail 430 to the server 105 indicated by the non-instruction part 413 based on HTTP, so as to complete the sending of the target mail.
[0128] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for sending an email. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0129] like Figure 5 As shown, the device 500 for sending an email in this embodiment may include: an initial email parsing unit 501, an instruction content execution unit 502, a first email generating unit 503 and a target email sending unit 504. The initial email parsing unit 501 is configured to parse the initial email to obtain the email content of the initial email, wherein the initial email is transmitted based on the simple mail transfer protocol; the instruction content execution unit 502 is configured to execute the to-be-executed instruction corresponding to the instruction content part in response to the instruction content part included in the email content, and obtain the execution result; the first email generating unit 503 is configured to generate a target email in a target format based on the non-instruction content part of the email content and the execution result; the target email sending unit 504 is configured to send the target email to the target address indicated in the non-instruction content part.
[0130] In the present embodiment, in the device for sending an email 500, the specific processing of the to-be-annotated image acquisition unit, the initial email parsing unit 501, the instruction content execution unit 502, the first email generation unit 503 and the target email sending unit 504 and the technical effects thereof can be referred to in detail. Figure 2 The relevant descriptions of steps 201 - 204 in the corresponding embodiment are not repeated here.
[0131] In some optional implementations of the present embodiment, the initial email parsing unit 501 includes: a line terminator determination subunit, configured to determine the line terminator included in the code data of the initial email; a content unit segmentation unit, configured to separate the email content units based on the line terminator; an initial email parsing subunit, configured to obtain the sub-mail content corresponding to each email content unit based on the matching results of the fields included in each email content unit and the preset fields, wherein the email content is composed of the contents of each sub-mail.
[0132] In some optional implementations of this embodiment, the instruction content execution unit 502 includes: a code and parameter determination subunit, which is configured to parse the instruction content part through a regular expression or a state machine model in response to the instruction content part included in the email content, to obtain an action code and action parameters; an instruction part execution subunit, which is configured to execute the action code according to the action parameters to obtain an execution result.
[0133] In some optional implementations of this embodiment, the device 500 also includes: a preview image generation unit, configured to generate a preview image corresponding to the attachment file in response to the execution result being an attachment file; and a first email generation unit, further configured to generate a target email in a target format based on the non-instruction content portion of the email content, the execution result and the preview image.
[0134] In some optional implementations of this embodiment, the first mail generating unit 503 is further configured to generate a target mail in a target format according to the non-instruction content part, the instruction content part and the execution result.
[0135] In some optional implementations of this embodiment, the apparatus 500 further includes: a second mail generating unit configured to generate a target mail in a target format based on the mail content in response to the absence of the instruction content portion in the mail content.
[0136] In some optional implementations of this embodiment, the device 500 also includes: an error information generating unit, configured to generate error information corresponding to the Simple Mail Transfer Protocol based on the code data of the initial email corresponding to the parsing error in response to a parsing error occurring in the process of parsing the initial email to obtain the email content; and an error information providing unit, configured to send error information to the provider of the initial email based on the Simple Mail Transfer Protocol.
[0137] In some optional implementations of this embodiment, the target mail sending unit 504 is further configured to send the target mail to the target address indicated in the non-instruction content part via the hypertext transfer protocol.
[0138] In some optional implementations of this embodiment, the target format includes: Multipurpose Internet Mail Extensions format.
[0139] This embodiment exists as a device embodiment corresponding to the above method embodiment. The device for sending mail provided by this embodiment parses the initial mail to obtain the mail content of the initial mail, wherein the initial mail is transmitted based on the simple mail transfer protocol; in response to the instruction content part included in the mail content, executes the to-be-executed instruction corresponding to the instruction content part to obtain the execution result; generates a target mail in a target format based on the non-instruction content part of the mail content and the execution result; and sends the target mail to the target address indicated in the non-instruction content part. As a result, the mail sent based on the simple mail transfer protocol can also be attached with more types and more kinds of mail content, which can improve the compatibility of message transmission and meet different and diversified communication needs.
[0140] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0141] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0142] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0143] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0144] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a method for sending an email. For example, in some embodiments, the method for sending an email may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the method for sending an email described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute a method for sending an email in any other appropriate manner (e.g., by means of firmware).
[0145] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0146] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0147] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0148] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0149] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0150] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services. The server can also be divided into a server of a distributed system, or a server combined with a blockchain.
[0151] According to the technical solution of the embodiment of the present disclosure, the initial email is parsed to obtain the email content of the initial email, wherein the initial email is transmitted based on the Simple Mail Transfer Protocol; in response to the instruction content part included in the email content, the to-be-executed instruction corresponding to the instruction content part is executed to obtain the execution result; based on the non-instruction content part of the email content and the execution result, a target email in a target format is generated; and the target email is sent to the target address indicated in the non-instruction content part. As a result, the emails sent based on the Simple Mail Transfer Protocol can also be attached with more types and more kinds of email content, which can improve the compatibility of message transmission and meet different and diversified communication needs.
[0152] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and this document does not limit this.
[0153] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for sending an email, comprising: Parsing an initial email to obtain email content of the initial email, wherein the initial email is transmitted based on a simple mail transfer protocol; In response to the email content including the instruction content part, executing the to-be-executed instruction corresponding to the instruction content part to obtain an execution result; Generate a target email in a target format based on the non-instruction content portion of the email content and the execution result; The target mail is sent to the target address indicated in the non-instruction content part.
2. The method according to claim 1, wherein: The parsing of the initial email to obtain the email content of the initial email includes: Determining a line terminator included in the code data of the initial email; Segment the email content unit based on the line terminator; Based on the matching result between the fields included in each of the mail content units and the preset fields, the sub-mail contents corresponding to each of the mail content units are obtained, wherein the mail content is composed of the sub-mail contents.
3. The method according to claim 1, wherein: In response to the email content including the instruction content part, executing the to-be-executed instruction corresponding to the instruction content part to obtain the execution result includes: In response to the instruction content being included in the email content, the instruction content is parsed by using a regular expression or a state machine model to obtain an action code and an action parameter; The action code is executed according to the action parameters to obtain the execution result.
4. The method according to claim 3, further comprising: In response to the execution result being an attachment file, generating a preview image corresponding to the attachment file; as well as The step of generating a target email in a target format based on the non-instruction content portion of the email content and the execution result includes: A target email in the target format is generated according to the non-instruction content portion of the email content, the execution result and the preview image.
5. The method according to claim 1, wherein: The step of generating a target email in a target format based on the non-instruction content portion of the email content and the execution result includes: A target email in a target format is generated according to the non-instruction content part, the instruction content part and the execution result.
6. The method according to claim 1, further comprising: In response to the absence of the instruction content portion in the mail content, a target mail in the target format is generated based on the mail content.
7. The method according to claim 1, further comprising: In response to a parsing error occurring during the process of parsing the initial email to obtain the email content, generating error information corresponding to the Simple Mail Transfer Protocol based on code data of the initial email corresponding to the parsing error; Based on the Simple Mail Transfer Protocol, the error message is sent to a provider of the initial email.
8. The method according to claim 1, wherein: The sending the target email to the target address indicated in the non-instruction content part comprises: The target email is sent to the target address indicated in the non-instruction content part through the hypertext transfer protocol.
9. The method according to any one of claims 1 to 8, wherein: The target format includes: Multipurpose Internet Mail Extensions format.
10. A device for sending mails, comprising: an initial mail parsing unit, configured to parse an initial mail to obtain mail content of the initial mail, wherein the initial mail is transmitted based on a simple mail transfer protocol; an instruction content execution unit, configured to execute the to-be-executed instruction corresponding to the instruction content part in response to the instruction content part being included in the email content, and obtain an execution result; A first mail generating unit is configured to generate a target mail in a target format based on the non-instruction content portion of the mail content and the execution result; The target mail sending unit is configured to send the target mail to the target address indicated in the non-instruction content part.
11. The device according to claim 10, wherein: The initial mail parsing unit includes: A line terminator determination subunit, configured to determine a line terminator included in the code data of the initial email; a content unit segmentation unit configured to segment the email content units based on the line terminator; The initial email parsing subunit is configured to obtain the sub-mail content corresponding to each email content unit based on the matching result between the field included in each email content unit and the preset field, wherein the email content is composed of each sub-mail content.
12. The device according to claim 10, wherein: The instruction content execution unit includes: A code and parameter determination subunit is configured to parse the instruction content part by a regular expression or a state machine model in response to the instruction content part being included in the email content, so as to obtain an action code and an action parameter; The instruction part execution subunit is configured to execute the action code according to the action parameters to obtain the execution result.
13. The device according to claim 12, further comprising: A preview image generating unit, configured to generate a preview image corresponding to the attachment file in response to the execution result being an attachment file; And the first mail generating unit is further configured to generate a target mail in the target format according to the non-instruction content part of the mail content, the execution result and the preview image.
14. The device according to claim 10, wherein: The first mail generating unit is further configured to generate a target mail in a target format according to the non-instruction content part, the instruction content part and the execution result.
15. The apparatus according to claim 10, further comprising: The second mail generating unit is configured to generate a target mail in the target format based on the mail content in response to the absence of the instruction content part in the mail content.
16. The apparatus according to claim 10, further comprising: an error message generating unit, configured to generate error message corresponding to the simple mail transfer protocol based on code data of the initial mail corresponding to the parsing error in response to a parsing error occurring in the process of parsing the initial mail to obtain the mail content; The error information providing unit is configured to send the error information to the provider of the initial email based on the Simple Mail Transfer Protocol.
17. The device according to claim 10, wherein: The target mail sending unit is further configured to send the target mail to the target address indicated in the non-instruction content part through the hypertext transfer protocol.
18. The device according to any one of claims 10 to 17, wherein: The target format includes: Multipurpose Internet Mail Extensions format.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method for sending an email according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method for sending an email according to any one of claims 1 to 9.
21. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method for sending an email according to any one of claims 1 to 9.