E-mail processing method and device, equipment, storage medium and program

By introducing message queueing technology into the email system, the problem of poor performance of traditional email systems in high concurrency situations is solved, and more efficient and stable email processing is achieved.

CN119697151AInactive Publication Date: 2025-03-25KYLIN CORP
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510206017.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-03-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional email systems perform poorly when sending requests with high concurrent mail, affecting other business requests.

Method used

Message queue technology is introduced, by generating and storing mail files, generating mail messages, and storing them into the target resolution queue and business queue, and using consumer programs and business handlers for parsing and legality checking, and finally sending the mail files that pass legality checking to the mail server.

Benefits of technology

It improves email processing efficiency and system stability, and can better deal with highly concurrent email sending requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697151A_ABST
    Figure CN119697151A_ABST
Patent Text Reader

Abstract

The invention relates to an E-mail processing method and device, equipment, a storage medium and a program, and the method comprises the steps: generating and storing an E-mail file according to an E-mail sending request; for each mail file, generating a first mail message corresponding to the mail file; for each first mail message, storing the first mail message into a target analysis queue by analyzing the total mail size in each existing mail analysis queue; the consumer program corresponding to the target analysis queue analyzes the corresponding mail file according to the first mail message to obtain a second mail message of the corresponding mail file; for each second mail message, storing the second mail message into a target service queue by analyzing the total message quantity in each existing service queue; the service processing program corresponding to the target service queue checks the validity of the corresponding mail file according to the second mail message; and sending the mail file passing the validity check to a mail server. By adopting the method, the mail processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer communication technology, and in particular to an email processing method, device, equipment, storage medium and program. Background Art

[0002] At present, email systems have been applied in all aspects of life. The number of emails sent by users every day has exploded, and the pressure on email servers has also increased. The architecture of traditional email systems can no longer cope with a large number of email sending requests. Traditional email sending systems directly pass the constructed eml files to the mail server, so the mail server has poor performance when dealing with high-concurrency sending requests, and may even affect other business requests. Message queue technology can provide asynchronous communication, message storage and other capabilities, and has good scalability and stability. Therefore, how to introduce message queue technology into the email system to improve the processing efficiency and stability of the system is an important research direction in the existing technology. Summary of the invention

[0003] Based on this, it is necessary to provide an email processing method, device, equipment, storage medium and program to address the above technical problems in order to improve email processing efficiency.

[0004] In a first aspect, the present invention provides an email processing method, the method comprising: Generate and store mail files according to mail sending request; For each mail file, generating a first mail message corresponding to the mail file; For each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue; The consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain the second mail message corresponding to the mail file; For each second email message, the second email message is stored in the target business queue by parsing the total number of messages in each existing business queue; The business processing program corresponding to the target business queue performs a validity check on the corresponding email file according to the second email message; Send the email files that pass the validity check to the email server.

[0005] In one embodiment, for each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue includes: For the current first email message, if there is a to-be-selected parsing queue that meets the first condition in the existing email parsing queue, the current first email message is stored in the to-be-selected parsing queue with the smallest total email size; if there is no to-be-selected parsing queue that meets the first condition in the existing email parsing queue, a new email parsing queue is created, and the current first email message is stored in the new email parsing queue; The first condition is that the total size of emails in the email parsing queue is less than a first preset threshold.

[0006] In one embodiment, for each second email message, storing the second email message in a target service queue by parsing the total number of messages in each existing service queue includes: For the current second email message, if there is a to-be-selected business queue that meets the second condition in the existing business queues, the current second email message is stored in the to-be-selected business queue with the minimum total number of messages; if there is no to-be-selected business queue that meets the second condition in the existing business queues, a new business queue is created, and the current second email message is stored in the new business queue; The second condition is that the total number of messages in the service queue is less than a second preset threshold.

[0007] In one embodiment, the second email message includes at least one item of email attribute information, and the service processing program corresponding to the target service queue performs a validity check on the corresponding email file according to the second email message, including: The service processing program corresponding to the target service queue determines whether the corresponding mail file passes the legality check by checking whether at least one item of mail attribute information satisfies the corresponding verification rule.

[0008] In one embodiment, determining whether a corresponding email file passes a validity check by checking whether at least one email attribute information satisfies a corresponding validity rule includes: If there is mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file does not pass the legality check; if there is no mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file passes the legality test.

[0009] In one of the embodiments, the second email message also includes an email storage location, and the method further includes: After the second email message is parsed and obtained, if the security scan is set to be turned on, the second email message is stored in the security scan queue; The security scanning program corresponding to the security scanning queue obtains the corresponding email file according to the email storage location in the second email message, and performs a security scan on the email file; For each second email message corresponding to the email file that passes the security scan, the second email message is stored in the target service queue by parsing the total number of messages in each existing service queue.

[0010] In a second aspect, the present invention further provides an email sending device, the device comprising: A first generating module, used for generating and storing an email file according to an email sending request; A second generating module, configured to generate, for each mail file, a first mail message corresponding to the mail file; A first parsing module, configured to store each first email message into a target parsing queue by parsing the total email size in each existing email parsing queue; A second parsing module, used for a consumer program corresponding to a target parsing queue to parse a corresponding mail file according to the first mail message, and obtain a second mail message corresponding to the mail file; A third parsing module is used for storing each second email message into a target business queue by parsing the total number of messages in each existing business queue; A checking module, used for the business processing program corresponding to the target business queue to perform a legitimacy check on the corresponding email file according to the second email message; The sending module is used to send the mail files that pass the validity check to the mail server.

[0011] In a third aspect, the present invention further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented: Generate and store mail files according to mail sending request; For each mail file, generating a first mail message corresponding to the mail file; For each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue; The consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain the second mail message corresponding to the mail file; For each second email message, the second email message is stored in the target business queue by parsing the total number of messages in each existing business queue; The business processing program corresponding to the target business queue performs a validity check on the corresponding email file according to the second email message; Send the email files that pass the validity check to the email server.

[0012] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented: Generate and store mail files according to mail sending request; For each mail file, generating a first mail message corresponding to the mail file; For each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue; The consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain the second mail message corresponding to the mail file; For each second email message, the second email message is stored in the target business queue by parsing the total number of messages in each existing business queue; The business processing program corresponding to the target business queue performs a validity check on the corresponding email file according to the second email message; Send the email files that pass the validity check to the email server.

[0013] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which implements the following steps when executed by a processor: Generate and store mail files according to mail sending request; For each mail file, generating a first mail message corresponding to the mail file; For each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue; The consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain the second mail message corresponding to the mail file; For each second email message, the second email message is stored in the target business queue by parsing the total number of messages in each existing business queue; The business processing program corresponding to the target business queue performs a validity check on the corresponding email file according to the second email message; Send the email files that pass the validity check to the email server.

[0014] The above-mentioned email processing method, device, equipment, storage medium and program introduce message queue technology in the email sending process. In the first email distribution rule, the first email message is distributed according to the total email size in the existing email parsing queue; in the second email distribution rule, the second email message is distributed according to the total number of messages in the existing business queue, thereby improving the email processing efficiency under high concurrent email sending requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments of the present invention or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 The figure is a flowchart of an email processing method in one embodiment. DETAILED DESCRIPTION

[0017] The technical scheme in the embodiment of the present invention is described clearly and completely below in conjunction with the accompanying drawings in the embodiment of the present invention. In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.

[0018] In order to facilitate understanding of the technical solution in this application, the following description is first made: Mail parsing queues, business queues, and security scanning queues are all message queues (or queues to be processed). Message queues are mainly used for message distribution and storage to prevent high concurrency overload issues.

[0019] The storage space in the message queue is limited and cannot directly store mail files. It can only store messages. The message body of each message includes pointer information for accessing the mail file, and the corresponding mail file can be accessed through the pointer information.

[0020] The message queue is not an execution unit. Tasks need to be executed through the program corresponding to the message queue. According to actual needs, at least one corresponding program can be set for the message queue. The default is 1. Each program can be assigned at least one thread. The thread is the smallest unit for executing tasks. By assigning multiple threads to a program, the program can execute multiple tasks in parallel.

[0021] In an optional embodiment, a method for processing an email is provided. In this embodiment, the method comprises the following steps: S110, generating and storing an email file according to the email sending request.

[0022] The mail sending request may come from a web or a client, etc. Generating and storing the mail file may include converting the mail content in the mail sending request into a mail file conforming to a standard format of electronic mail (RFC 822), and storing the mail file in the server.

[0023] S120: For each mail file, generate a first mail message corresponding to the mail file.

[0024] Optionally, the first mail message may include a mail name, etc. The mail name may be generated according to information such as a current timestamp and a mail file storage address, etc., and used as pointer information for accessing a corresponding mail file.

[0025] S130: For each first email message, the total email size in each existing email parsing queue is parsed, and the first email message is stored in a target parsing queue.

[0026] The target parsing queue may be understood as a queue for parsing the mail file corresponding to the first mail message.

[0027] Optionally, for any existing mail parsing queue, the storage space occupied by the corresponding mail file can be obtained through each first mail message in the mail parsing queue. The sum of the storage space occupied by the mail files corresponding to all the first mail messages in the mail parsing queue is the total mail size of the mail parsing queue.

[0028] In an optional embodiment, the method for determining the target resolution queue may include: For the current first email message, if there is a to-be-selected parsing queue that meets the first condition in the existing email parsing queue, the current first email message is stored in the to-be-selected parsing queue with the smallest total email size; If there is no to-be-selected parsing queue that meets the first condition in the existing mail parsing queues, a new mail parsing queue is created, and the current first mail message is stored in the new mail parsing queue.

[0029] It is understandable that the larger the total email size in the email parsing queue, the greater the parsing pressure and the lower the parsing efficiency; correspondingly, the smaller the total email size in the email parsing queue, the smaller the parsing pressure and the higher the parsing efficiency. Therefore, the first condition can be set to that the total email size in the email parsing queue is less than the first preset threshold. The first preset threshold can be understood as the upper limit of the total email size. For any email parsing queue, if its total email size is less than the first preset threshold, it means that the email parsing queue still has the ability to accommodate the first email message; if its total email size is equal to the first preset threshold, it means that the email parsing queue is full.

[0030] Furthermore, the queue to be parsed can be understood as the mail parsing queue that can still accommodate the first mail message. In combination with the above content, it can be seen that among all the queues to be parsed, the queue to be parsed with the smallest total mail size has the smallest parsing pressure and the highest parsing efficiency, so the current first mail message can be stored in the queue to be parsed with the smallest total mail size.

[0031] Furthermore, if there is no candidate parsing queue that meets the first condition in the existing mail parsing queue, it means that the quota of the current mail parsing queue cannot cope with the parsing load, and a new mail parsing queue can be created, and the current first mail message can be stored in the new mail parsing queue. However, if the number of existing mail parsing queues reaches the quota limit, a new mail parsing queue can no longer be created. According to the configuration information, a mail parsing queue can be reassigned to the current first mail message after a period of time, or the current first mail message can be directly discarded and an alarm message can be sent.

[0032] S140, the consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain a second mail message corresponding to the mail file.

[0033] Compared with the first email message, the second email message can be understood as an email message containing more information obtained by further parsing the email file. The consumer program can be understood as a program that processes the first email message.

[0034] Exemplarily, the consumer program may parse the email name from the message body of the first email message; obtain the corresponding email file from the storage space according to the email name; and parse the email file to obtain the second email message of the email file.

[0035] S150: For each second email message, the total number of messages in each existing service queue is parsed, and the second email message is stored in a target service queue.

[0036] The target service queue may be understood as a queue for checking the mail file corresponding to the second mail message.

[0037] Optionally, for any existing service queue, the number of second email messages in the service queue, that is, the total number of messages in the service queue, may be obtained.

[0038] In an optional embodiment, the method for determining the target service queue may include: For the current second email message, if there is a to-be-selected service queue that meets the second condition in the existing service queues, the current second email message is stored in the to-be-selected service queue with the minimum total number of messages; If there is no to-be-selected service queue that meets the second condition in the existing service queues, a new service queue is created, and the current second mail message is stored in the new service queue.

[0039] It is understandable that the greater the total number of messages in the business queue, the greater the processing pressure and the lower the processing efficiency; correspondingly, the smaller the total number of messages in the business queue, the smaller the processing pressure and the higher the processing efficiency. Therefore, the second condition can be set to that the total number of messages in the business queue is less than the second preset threshold. The second preset threshold can be understood as the upper limit of the total number of messages. For any business queue, if its total number of messages is less than the second preset threshold, it means that the business queue still has the ability to accommodate the second email message; if its total number of messages is equal to the second preset threshold, it means that the business queue is full.

[0040] Furthermore, the service queue to be selected can be understood as a service queue that can still accommodate the second email message. In combination with the above content, it can be seen that among all service queues to be selected, the service queue to be selected with the smallest total number of messages has the smallest processing pressure and the highest processing efficiency, so the current second email message can be stored in the service queue to be selected with the smallest total number of messages.

[0041] Furthermore, if there is no to-be-selected business queue that meets the second condition in the existing business queues, it means that the quota of the current business queue cannot cope with the processing load, and a new business queue can be created, and the current second email message can be stored in the new business queue. However, if the number of existing business queues reaches the quota upper limit, a new business queue can no longer be created, and according to the configuration information, a business queue can be reassigned to the current second email message after a period of time, or the current second email message can be directly discarded and an alarm message can be sent.

[0042] S160: The service processing program corresponding to the target service queue performs a validity check on the corresponding email file according to the second email message.

[0043] The second email message may include at least one item of email attribute information, such as email subject, sender information, recipient information, email size, basic information of email attachments, email storage information (for example, email text content is stored in a specified area according to a configured threshold size), etc.

[0044] In an optional embodiment, the method for checking the legitimacy of an email file may include: The service processing program corresponding to the target service queue determines whether the corresponding mail file passes the legality check by checking whether at least one item of mail attribute information satisfies the corresponding verification rule.

[0045] For example, the address legitimacy check can be performed on the recipient information to confirm whether the recipient address is legal (black and white list verification); the authority legitimacy check can be performed on the sender information to confirm whether the sender has the sending authority.

[0046] In an optional embodiment, if there is mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file does not pass the legality check; if there is no mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file passes the legality test.

[0047] Optionally, the service processing program corresponding to the target service queue may further perform service processing on the mail attribute information in the second mail message, for example, splitting the recipient information and the like.

[0048] In an optional embodiment, the second email message may include an email storage location (e.g., the email name mentioned above). After the second email message is parsed, if the security scan is set to on, the second email message is stored in a security scan queue; the security scan program corresponding to the security scan queue obtains the corresponding email file according to the email storage location in the second email message, and performs a security scan on the email file; for each second email message corresponding to an email file that passes the security scan, the second email message is stored in a target business queue by parsing the total number of messages in each existing business queue.

[0049] That is, if the security scan is set to on, the second email message can be stored in the security scan queue first, and after the security scan is completed, the second email message can be stored in the target service queue; if the security scan is set to off, the second email message can be directly stored in the target service queue. The security scan performed by the security scanning program on the email file can include virus scanning, etc.

[0050] S170, sending the email file that has passed the validity check to the email server.

[0051] In this embodiment, message queue technology is introduced in the email sending process. In the first email distribution rule, the first email message is distributed according to the total email size in the existing email parsing queue; in the second email distribution rule, the second email message is distributed according to the total number of messages in the existing business queue, thereby improving the email processing efficiency under high concurrent email sending requests.

[0052] In another alternative embodiment, Figure 1 As shown, a method for processing an email is provided. In this embodiment, the method comprises the following steps: S201, the mail sending module receives a mail sending request and generates a mail file and a corresponding first mail message; S202, according to the mail distribution principle 1, distribute each first mail message to the parsing queue; S203, parsing the consumer program corresponding to the queue, parsing the mail file corresponding to the first mail message, and obtaining a second mail message corresponding to the mail file; S204, according to email distribution principle 2, distribute each second email message to the email service processing queue; S205, the consumer program corresponding to the mail service processing queue performs service verification processing on the mail file corresponding to the second mail message; S206, the consumer program corresponding to the mail service processing queue sends the log information to the log monitoring module; S207, the monitoring program monitors the running status of each parsing queue and mail service processing queue in real time.

[0053] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0054] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.

[0055] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. An email processing method, characterized in that: The method comprises: Generate and store mail files according to mail sending request; For each mail file, generating a first mail message corresponding to the mail file; For each first email message, storing the first email message in a target parsing queue by parsing the total email size in each existing email parsing queue; The consumer program corresponding to the target parsing queue parses the corresponding mail file according to the first mail message to obtain the second mail message corresponding to the mail file; For each second email message, the second email message is stored in the target business queue by parsing the total number of messages in each existing business queue; The business processing program corresponding to the target business queue performs a validity check on the corresponding email file according to the second email message; Send the email files that pass the validity check to the email server.

2. The method according to claim 1, characterized in that The step of storing each first email message in a target parsing queue by parsing the total email size in each existing email parsing queue comprises: For the current first email message, if there is a to-be-selected parsing queue that meets the first condition in the existing email parsing queue, the current first email message is stored in the to-be-selected parsing queue with the smallest total email size; if there is no to-be-selected parsing queue that meets the first condition in the existing email parsing queue, a new email parsing queue is created, and the current first email message is stored in the new email parsing queue; The first condition is that the total size of emails in the email parsing queue is less than a first preset threshold.

3. The method according to claim 1, characterized in that The step of storing each second email message in the target service queue by parsing the total number of messages in each existing service queue includes: For the current second email message, if there is a to-be-selected business queue that meets the second condition in the existing business queues, the current second email message is stored in the to-be-selected business queue with the minimum total number of messages; if there is no to-be-selected business queue that meets the second condition in the existing business queues, a new business queue is created, and the current second email message is stored in the new business queue; The second condition is that the total number of messages in the service queue is less than a second preset threshold.

4. The method according to claim 1, characterized in that: The second mail message includes at least one item of mail attribute information, and the service processing program corresponding to the target service queue performs a validity check on the corresponding mail file according to the second mail message, including: The service processing program corresponding to the target service queue determines whether the corresponding mail file passes the legality check by checking whether at least one item of mail attribute information satisfies the corresponding verification rule.

5. The method according to claim 4, characterized in that The step of determining whether the corresponding email file passes the legality check by checking whether at least one item of email attribute information satisfies the corresponding legality rule comprises: If there is mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file does not pass the legality check; if there is no mail attribute information that does not satisfy the corresponding verification rule, it is determined that the corresponding mail file passes the legality test.

6. The method according to claim 1, characterized in that The second email message also includes an email storage location, and the method further includes: After the second email message is parsed and obtained, if the security scan is set to be turned on, the second email message is stored in the security scan queue; The security scanning program corresponding to the security scanning queue obtains the corresponding email file according to the email storage location in the second email message, and performs a security scan on the email file; For each second email message corresponding to the email file that passes the security scan, the second email message is stored in the target service queue by parsing the total number of messages in each existing service queue.

7. An electronic mail sending device, characterized in that: The device comprises: A first generating module, used for generating and storing an email file according to an email sending request; A second generating module, configured to generate, for each mail file, a first mail message corresponding to the mail file; A first parsing module, configured to store each first email message into a target parsing queue by parsing the total email size in each existing email parsing queue; A second parsing module, used for a consumer program corresponding to a target parsing queue to parse a corresponding mail file according to the first mail message, and obtain a second mail message corresponding to the mail file; A third parsing module is used to store each second email message into a target business queue by parsing the total number of messages in each existing business queue; A checking module, used for the business processing program corresponding to the target business queue to perform a legitimacy check on the corresponding email file according to the second email message; The sending module is used to send the mail files that pass the validity check to the mail server.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Queue management method and apparatus, computer system and computer readable medium

    CN101295267A

  • Service processing method and device based on message queue, equipment and storage medium

    CN112527534A

  • Mail sending method and device, electronic equipment and storage medium

    CN112737926A

  • Message processing method, device and equipment

    CN115550284A

  • Cross-cluster service message sending method, device and equipment

    CN117061612A