CN112134790B - Priority-based mail sending method, device, equipment and storage medium - Google Patents

Priority-based mail sending method, device, equipment and storage medium Download PDF

Info

Publication number
CN112134790B
CN112134790B CN202011040403.0A CN202011040403A CN112134790B CN 112134790 B CN112134790 B CN 112134790B CN 202011040403 A CN202011040403 A CN 202011040403A CN 112134790 B CN112134790 B CN 112134790B
Authority
CN
China
Prior art keywords
mail
sending
priority
request
mails
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011040403.0A
Other languages
Chinese (zh)
Other versions
CN112134790A (en
Inventor
丁志明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Pension Insurance Corp
Original Assignee
Ping An Pension Insurance Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Pension Insurance Corp filed Critical Ping An Pension Insurance Corp
Priority to CN202011040403.0A priority Critical patent/CN112134790B/en
Publication of CN112134790A publication Critical patent/CN112134790A/en
Application granted granted Critical
Publication of CN112134790B publication Critical patent/CN112134790B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/214Monitoring or handling of messages using selective forwarding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/23Reliability checks, e.g. acknowledgments or fault reporting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/42Mailbox-related aspects, e.g. synchronisation of mailboxes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a priority-based mail sending method, which comprises the following steps: acquiring the sending success time and the reading receipt time of various mails within a preset time period; calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm; acquiring mails to be sent in a current time period, and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises a priority corresponding to the mail; caching the mail sending requests in a request queue, and sequencing the mail sending requests in the request queue according to the priority of the mail sending requests; and reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests, and sending the mails according to the mail data obtained after analysis. The problem of sending the mails can be effectively solved.

Description

Priority-based mail sending method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a priority-based mail sending method, device, equipment and storage medium.
Background
When sending mails, the mail function of the existing mailbox randomly orders and sends all the mails to be sent or orders the mails according to the generation time of the mail task, so that the urgency degree of the mail task cannot be effectively embodied. Under the condition that system resources are sufficient and the quantity of mails to be sent is not large, the mails can be sent within tolerable time, and the contradiction is not obvious; once the mail tasks are overstocked due to system maintenance or version-off service or time consumption of some mail tasks, some mails with high requirement on timeliness cannot be sent out in time.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method, an apparatus, a device and a storage medium for sending a mail based on priority, which can effectively solve the problem of sending the mail.
In order to achieve the above object, an embodiment of the present invention provides a priority-based email sending method, including:
acquiring the sending success time and the reading receipt time of various mails within a preset time period;
calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm;
acquiring mails to be sent in a current time period, and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises a priority corresponding to the mail;
caching the mail sending requests in a request queue, and sequencing the mail sending requests in the request queue according to the priority of the mail sending requests;
and reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests, and sending mails according to the mail data obtained after analysis.
Further, before the acquiring the sending success time and the reading receipt time of the multiple types of mails in the preset time period, the method includes:
monitoring the plurality of types of mails;
and establishing a timing task to record the sending success time and the reading receipt time of various types of mails.
Further, the caching the mail sending request in a request queue, and the sorting the mail sending requests in the request queue according to the priority of the mail sending request includes:
sorting the mail sending requests in the request queue according to the priority and the cache time of the mail sending requests; wherein, the first and the second end of the pipe are connected with each other,
for the mail sending requests with different priorities, the mail sending request with low priority is ranked in front of the mail sending request with high priority;
for the mail sending requests with the same priority, the mail sending request with the earlier cache time is ranked before the mail sending request with the later cache time.
Further, the sequentially reading the mail sending requests from the request queue, analyzing the mail sending requests, and sending the mails according to the mail data obtained after analysis includes:
creating a mail sending thread;
judging whether the position of the last read mail sending request is the last position of the request queue or not according to the mail sending thread, if so, returning to the first position of the request queue to read the mail sending request, and if not, starting to read the mail sending request from the next position of the last read position;
and analyzing the mail sending request based on the mail sending thread, and calling an application programming interface of a mail server to send the mail according to the mail data obtained after analysis.
Further, the reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests, and after sending the mails according to the mail data obtained after analysis, the method includes:
judging whether the mail is successfully sent or not through the mail sending thread;
if the mail is successfully sent, deleting the mail sending request corresponding to the mail from the request queue;
if the transmission fails, deleting the mail transmission request corresponding to the mail from the request queue, and then re-caching the mail transmission request in the request queue and sequencing.
Further, the method further comprises:
when sending the mails in the next time period, acquiring the unsent mails in the current time period and the newly added sent mails in the next time period;
and determining the priority of the newly added sent mails, and reordering the sending requests corresponding to the newly added mails and the unsent mails in the request queue according to the priority.
Further, the method further comprises:
and caching the mail sending request and at least one mail in the mail sending request and the priority corresponding to the mail into a block chain.
In order to achieve the above object, an embodiment of the present invention provides a priority-based mail sending apparatus, including:
the acquisition module is used for acquiring the sending success time and the reading receipt time of various mails within a preset time period;
the calculation module is used for calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm;
the generating module is used for acquiring mails to be sent in the current time period and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises the priority corresponding to the mail;
the sorting module is used for caching the mail sending request in a request queue and sorting the mail sending requests in the request queue according to the priority of the mail sending request;
and the analysis sending module is used for reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests and sending mails according to the mail data obtained after analysis.
Further, the ranking module is further to:
sorting the mail sending requests in the request queue according to the priority and the cache time of the mail sending requests: wherein, the first and the second end of the pipe are connected with each other,
for the mail sending requests with different priorities, the mail sending request with low priority is ranked in front of the mail sending request with high priority;
for the mail sending requests with the same priority, the mail sending request with the early cache time is ranked before the mail sending request with the later cache time.
To achieve the above object, an embodiment of the present invention provides a computer device, which includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the computer program, when executed by the processor, implements the steps of the priority-based mail sending method as described above.
To achieve the above object, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, where the computer program is executable by at least one processor, so as to cause the at least one processor to execute the steps of the priority-based mail sending method as described above.
According to the priority-based mail sending method, the priority-based mail sending device, the priority-based mail sending equipment and the priority-based mail storage medium, the priority of the mail is determined according to the sending success time and the reading receipt time of the mail, then the mail is cached in the queue, the mail sending request is read from the caching queue according to the priority, and the mail is sent, so that the important mail can be timely and reliably sent. The method and the system effectively reflect the actual emergency degree of the mail according to the attention degree of the receiver to the mail, thereby achieving the purpose that important mails can be sent out in time under the backlog condition of the mail and solving the problem of timeliness to a certain degree.
Drawings
Fig. 1 is a flowchart of a first embodiment of a priority-based email sending method according to the present invention.
Fig. 2 is a flowchart of step S110 according to an embodiment of the present invention.
Fig. 3 is a flowchart of step S160 according to an embodiment of the present invention.
Fig. 4 is a flowchart of step S180 according to an embodiment of the present invention.
Fig. 5 is a flowchart of step S190 in the first embodiment of the present invention.
Fig. 6 is a schematic diagram of program modules of a second priority-based mail sending apparatus according to an embodiment of the present invention.
Fig. 7 is a schematic diagram of a hardware structure of a third embodiment of the computer apparatus according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Example one
Referring to fig. 1, a flowchart of steps of a priority-based mail sending method according to a first embodiment of the present invention is shown. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. The following description is made by way of example with the computer device 2 as the execution subject. The details are as follows.
And step S100, acquiring the sending success time and the reading receipt time of various mails within a preset time period.
Specifically, the sending success time and the reading receipt time after each mail is sent within the preset time period are monitored and recorded. And a timing task is established in advance, and the sending success time and the reading receipt time of the mails sent every day are recorded every day. And monitoring the progress of the mail before acquiring the successful sending time and the receipt reading time of the mail, wherein the monitoring of the progress of the mail comprises mail receiving monitoring and mail sending monitoring. Mail reception monitoring: when a user receives a mail, the mail received by the user is intercepted in advance for virus checking and killing, the time of successful sending is recorded, and a monitoring report is generated. Mail reception monitoring does not require any modification to the user's mail program, monitoring the time the user opens the mail for reading, or the time from opening the mail to sending a reading receipt. The mail receiving monitoring only supports POP3 protocol, and can not monitor IMAP, MAPI and mail received through WEB. The email type is actually an email account type, and this is related to the mailing protocol supported by the corresponding email server. For example, the QQ mailbox supports the account types of POP3/IMAP/SMTP/Exchange and the like.
The mail delivery monitoring also includes the following functions: all mail clients using the SMTP protocol are supported. And virus scanning is carried out on the sent mails, the mails are prohibited from being sent if the mails are found to be infected, and the mails are permitted to be sent after the users clear the viruses, so that the viruses are prevented from being spread. The mail transmission monitoring supports only the SMTP protocol and does not support MAPI and mail transmitted through the Web.
Illustratively, referring to fig. 2, before the step S100, a step S110 is included:
step S111, monitoring the various types of mails.
Specifically, through asynchronous tasks, business or life related mails received by the mails are regularly monitored every day.
Step S112 sets up a timing task to record the transmission success time and reading receipt time of the plurality of types of mails.
Specifically, the time of success of sending mail and the time of collection of reading receipt are set every day so as to facilitate updating of the priority.
And step S120, calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm.
Specifically, the processing timeliness of each mail is obtained according to the sending time and the reading receipt time and is used as key basic data for calculating the priority; and calculating the priority of each mail type according to a priority algorithm. The priority algorithm is calculated as follows:
W(A)=(P(A))/(P(A)+P(B)+…+P(N));
P(A)=(V1+V2+…Vn)/n;
T=T2-T1;
wherein A, B, N and the like are the code numbers of the mails; w (A) represents: the priority of the mail; p (A) represents: e, mail average treatment aging; v represents: e, single treatment and aging of the mail; t1 represents: a single-time transmission success time representation of the mail; t2: reading the receipt time after the mail is sent once; t represents the treatment aging of the mail; n is a positive integer.
For example, the priority of the mail can also be divided according to the importance and the urgency of the mail content, and the more important mail has higher priority and the more urgent mail has higher priority. For example, the priority of the mail with the down server is set to be high, the priority of the mail with the physical machine CPU load exceeding 90% is set to be medium, and the priority of the mail with the physical machine CPU load exceeding 85% is set to be low.
Illustratively, an asynchronous task is established, the priority of the mail is refreshed once every day based on the latest data, the sending mechanism of the mail is dynamically adjusted, after the timeliness of a certain type of mail changes, the priority can be automatically adjusted step by step through sample accumulation, and the final accuracy of the priority is guaranteed. The asynchronous task is established as follows: some task processes can be pre-established in a local machine or other servers or even server clusters to process heavy services, the number of the task processes can be increased by a few, for example, 10 times of the cpu, and then data is asynchronously sent to the task processes by using the AsyncTcpConnection to be processed asynchronously, so that a processing result is obtained asynchronously.
Step S140, obtaining mails to be sent in the current time period, and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises a priority corresponding to the mail.
Specifically, a mail sending request is generated according to the mail to be sent in the current time period and the sending operation of the user to the mail, and the mail sending request may include one or more of the following information: request identification, receiver address, sender address, mail subject, mail content and priority of the mail; the priority of the mail may be: high, medium, or low, set according to a value of the priority of the mail, e.g., high above a certain value.
Step S160, buffering the mail sending requests in a request queue, and sorting the mail sending requests in the request queue according to the priority of the mail sending requests.
Specifically, when the mail is transmitted according to the mail transmission request, the transmission order is determined according to the latest priority, and the transmission is preferentially performed with a low priority value. The latest priority can be updated by establishing an asynchronous task, and the mail priority is refreshed once a day based on the latest received mail and the sending success time and reading receipt time of the mail.
Exemplarily, referring to fig. 3, the step S160 specifically includes:
step S161, sorting the mail sending requests in the request queue according to the priority and the cache time of the mail sending requests.
Step S162, wherein, for the mail sending requests with different priorities, the mail sending request with low priority is ranked before the mail sending request with high priority.
In step S163, for mail transmission requests of the same priority, a mail transmission request of an earlier buffer time is ranked ahead of a mail transmission request of a later buffer time.
Specifically, examples are as follows: for example, there are 5 mail sending requests in the request queue, which are: a No. 1 mail transmission request (high priority), a No. 2 mail transmission request (high priority), a No. 3 mail transmission request (medium priority), a No. 4 mail transmission request (medium priority), and a No. 5 mail transmission request (low priority).
When polling the request queue for the first time, reading the No. 5 mail sending request and sending the mail, and reading the No. 4 mail sending request and sending the mail; before reading the No. 1 mail sending request, judging that the mail corresponding to the No. 5 mail sending request is successfully sent, and deleting the No. 5 mail sending request from the request queue; then reading the No. 1 mail sending request and sending the mail; before reading the mail transmission request of number 2, judging that the transmission of the mail transmission request of number 4 fails, deleting the mail transmission request of number 4 from the request queue, re-caching the mail transmission request of number 4 in the request queue, and comparing the caching time of the re-cached mail transmission request of number 4 with that of the mail transmission request of number 3 with the same priority, wherein the caching time of the re-cached mail transmission request of number 4 is later than that of the mail transmission request of number 3, therefore, after sequencing the re-cached mail transmission request of number 4 after the mail transmission request of number 3, the re-cached mail transmission request of number 4 can be read and transmitted in the second polling request queue, thereby improving the reliability of the mail transmission.
And step S180, reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests, and sending the mails according to the mail data obtained after analysis.
Specifically, the priority of the mail sending request is read, the mails are sent according to the priority order, and if the priorities are the same, the factors such as the cache time and the like can be referred to.
Exemplarily, referring to fig. 4, the step S180 specifically includes:
in step S181, a mail sending thread is created.
Specifically, a mail sending thread is created to control sending of a mail, one thread refers to a single-order control flow in a process, a plurality of threads can be concurrently sent in one process, each thread executes different tasks in parallel, and sending of the mail is a single-thread task.
Step S182, judging whether the position of the last read mail sending request is the last bit of the request queue according to the mail sending thread, if so, returning to the first bit of the request queue to read the mail sending request, and if not, starting to read the mail sending request from the next bit of the last read position.
Specifically, the read mail sending request is judged according to the position of the last mail sending request in the request queue, and if the reading in the current request queue is completed, the newly added mail sending request is read.
And step S183, analyzing the mail sending request based on the mail sending thread, and calling an application programming interface of the mail server to send the mail according to the mail data obtained after analysis.
Specifically, the mail sending request is analyzed to obtain the mailbox address of the receiver, and then the mail is sent through an Application Programming Interface (API) of the mail server.
Exemplarily, referring to fig. 5, after the step S180, a step S190 is included:
and step S191, judging whether the mail is successfully sent or not through the mail sending thread.
Step S192, if the transmission is successful, the mail transmission request corresponding to the mail is deleted from the request queue.
Step S193, if the sending fails, deleting the mail sending request corresponding to the mail from the request queue, and then re-caching the mail sending request in the request queue and sorting the mail.
Specifically, when the mail is sent, a mail monitoring process running in a background; the mail monitoring process monitors the operation condition of the mail sending thread, and restarts the mail sending thread if the abnormal operation of the mail sending thread is detected; the mail monitoring process also regularly backs up the data in the request queue, and if the loss of the data in the request queue is detected, the request queue is automatically restored according to the backed-up data; the mail sending thread runs abnormally, for example: the mail sending thread automatically destroys or aborts (malfunctions) for some reason or error.
Illustratively, the method further comprises:
when sending the mails in the next time period, acquiring the unsent mails in the current time period and the newly added sent mails in the next time period; and determining the priority of the newly added sent mails, and reordering the sending requests corresponding to the newly added mails and the unsent mails in the request queue according to the priority.
Specifically, when the mail in the next time period is sent, the sending requests corresponding to the mails which are not sent in the current time period and the newly added mails in the next time period are reordered in the request queue, so that the urgent mails in the next time period can be sent preferentially.
Illustratively, the method further comprises:
and caching the mail sending request and at least one mail in the mail sending request and the priority corresponding to the mail into a block chain.
Specifically, uploading a mail sending request to the blockchain can ensure the safety and the fair transparency of the mail sending request to the user. The user equipment can download the mail sending request from the blockchain so as to check whether the mail and the corresponding priority of the mail are tampered. The blockchain referred to in this example is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Example two
Referring to fig. 6, a program module diagram of a second priority-based mail sending apparatus according to an embodiment of the invention is shown. In this embodiment, the priority-based mail sending apparatus 20 may include or be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors, to accomplish the present invention and realize the above-described priority-based mail sending method. The program module referred to in the embodiments of the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable than the program itself for describing the execution process of the priority-based mail transmission apparatus 20 in the storage medium. The following description will specifically describe the functions of the program modules of the present embodiment:
the obtaining module 200 is configured to obtain sending success times and reading receipt times of multiple types of mails within a preset time period.
Specifically, the sending success time and the reading receipt time after each mail is sent within the preset time period are monitored and recorded. And establishing a timing task in advance, and regularly recording the sending success time and the reading receipt time of the mails sent every day. And monitoring the progress of the mail before acquiring the successful sending time and the receipt reading time of the mail, wherein the monitoring of the progress of the mail is divided into mail receiving monitoring and mail sending monitoring. Mail reception monitoring: when a user receives a mail, the mail received by the user is intercepted in advance for virus checking and killing, the time of successful sending is recorded, and a monitoring report is generated. Mail reception monitoring does not require any modification to the user's mail program, monitoring the time the user opens the mail for reading, or the time from opening the mail to sending a reading receipt. The mail receiving monitoring only supports POP3 protocol, and can not monitor IMAP, MAPI and mail received through WEB. The email type is actually the account type of the email, and this is related to the mailing protocol supported by the corresponding email server. For example, the QQ mailbox supports the account types of POP3/IMAP/SMTP/Exchange and the like.
A calculating module 202, configured to calculate a priority of each type of email according to the sending success time, the reading receipt time, and a preset priority algorithm.
Specifically, the processing timeliness of each mail is obtained according to the sending time and the reading receipt time and is used as key basic data for calculating the priority; and calculating the priority of each mail type according to a priority algorithm. The priority algorithm is calculated as follows:
W(A)=(P(A))/(P(A)+P(B)+…+P(N));
P(A)=(V1+V2+…Vn)/n;
T=T2-T1;
wherein A, B, N and the like are the code numbers of the mails; w (A) represents: the priority of the mail; p (A) represents: e, mail average treatment aging; v represents: e, mail single treatment aging; t1 represents: a single-time transmission success time representation of the mail; t2: reading the receipt time after the mail is sent once; t represents the treatment aging of the mail; n is a positive integer.
The generating module 204 is configured to obtain a to-be-sent mail in a current time period, and generate a mail sending request of each mail according to the to-be-sent mail, where the to-be-sent mail includes at least one mail, and the mail sending request includes a priority corresponding to the mail.
Specifically, a mail sending request is generated according to the mail to be sent in the current time period and the sending operation of the user to the mail, and the mail sending request may include one or more of the following information: request identification, receiver address, sender address, mail subject, mail content, priority of mail; the priority of the mail may be: high, medium or low, set according to the value of the priority of the mail, for example high above a certain value.
The sorting module 206 is configured to cache the mail sending request in a request queue, and sort the mail sending requests in the request queue according to the priority of the mail sending request.
Specifically, when the mail is transmitted according to the mail transmission request, the transmission order is determined according to the latest priority, and the transmission is preferentially performed with a low priority value. The latest priority can be refreshed once a day based on the latest received mail and the transmission success time and reading receipt time of the mail by establishing an asynchronous task.
Illustratively, the sorting module 206 is specifically configured to:
and sorting the mail sending requests in the request queue according to the priority and the caching time of the mail sending requests.
Wherein, for the mail sending requests with different priorities, the mail sending request with low priority is ranked before the mail sending request with high priority.
For the mail sending requests with the same priority, the mail sending request with the earlier cache time is ranked before the mail sending request with the later cache time.
Specifically, the following are exemplified: for example, there are 5 mail sending requests in the request queue, which are: mail transmission request No. 1 (high priority), mail transmission request No. 2 (high priority), mail transmission request No. 3 (medium priority), mail transmission request No. 4 (medium priority), and mail transmission request No. 5 (low priority).
When the first polling request queue is used, reading the No. 5 mail sending request and sending the mail, and reading the No. 4 mail sending request and sending the mail; before reading the No. 1 mail sending request, judging that the mail corresponding to the No. 5 mail sending request is successfully sent, and deleting the No. 5 mail sending request from the request queue; then reading the No. 1 mail sending request and sending the mail; before reading the mail transmission request of number 2, judging that the transmission of the mail transmission request of number 4 fails, deleting the mail transmission request of number 4 from the request queue, re-caching the mail transmission request of number 4 in the request queue, and comparing the caching time of the re-cached mail transmission request of number 4 with that of the mail transmission request of number 3 with the same priority, wherein the caching time of the re-cached mail transmission request of number 4 is later than that of the mail transmission request of number 3, therefore, after sequencing the re-cached mail transmission request of number 4 after the mail transmission request of number 3, the re-cached mail transmission request of number 4 can be read and transmitted in the second polling request queue, thereby improving the reliability of the mail transmission.
And the analysis sending module 208 is configured to sequentially read the mail sending requests from the request queue, analyze the mail sending requests, and send mails according to the mail data obtained after analysis.
Specifically, the priority of the mail sending request is read, the mail is sent according to the priority sequence, and if the priority is the same, the factors such as the caching time and the like can be referred to.
Illustratively, the parsing and sending module 208 is specifically configured to:
and creating a mail sending thread.
Specifically, a mail sending thread is created to control sending of a mail, one thread refers to a single-order control flow in a process, multiple threads can be concurrently sent in one process, each thread executes different tasks in parallel, and sending of the mail is a single-thread task.
And judging whether the position of the last read mail sending request is the last bit of the request queue or not according to the mail sending thread, if so, returning to the first bit of the request queue to read the mail sending request, and if not, starting to read the mail sending request from the next bit of the last read position.
Specifically, the read mail sending request is judged according to the position of the last mail sending request in the request queue, and if the reading in the current request queue is completed, the newly added mail sending request is read.
And analyzing the mail sending request based on the mail sending thread, and calling an application programming interface of a mail server to send the mail according to the mail data obtained after analysis.
Specifically, the mail sending request is analyzed to obtain the mailbox address of the receiver, and then the mail is sent through an Application Programming Interface (API) of the mail server.
EXAMPLE III
Fig. 7 is a schematic diagram of a hardware architecture of a computer device according to a third embodiment of the present invention. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a preset or stored instruction. The computer device 2 may be a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers), and the like. As shown in fig. 7, the computer device 2 includes, but is not limited to, at least a memory 21, a processor 22, a network interface 23, and a priority-based mail sending apparatus 20, which are communicatively connected to each other through a system bus. Wherein:
in the present embodiment, the memory 21 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the computer device 2. Of course, the memory 21 may also comprise both internal and external memory units of the computer device 2. In this embodiment, the memory 21 is generally used for storing an operating system installed in the computer device 2 and various types of application software, such as the program codes of the priority-based mail sending apparatus 20 of the second embodiment. Further, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 22 is typically used to control the overall operation of the computer device 2. In this embodiment, the processor 22 is configured to run the program codes stored in the memory 21 or process data, for example, run the priority-based mail sending apparatus 20, so as to implement the priority-based mail sending method according to the first embodiment.
The network interface 23 may comprise a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the server 2 and other electronic systems. For example, the network interface 23 is used to connect the server 2 to an external terminal via a network, establish a data transmission channel and a communication connection between the server 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, and the like. It is noted that fig. 7 only shows the computer device 2 with components 20-23, but it is understood that not all shown components are required to be implemented, and that more or less components may be implemented instead.
In this embodiment, the priority-based mail sending apparatus 20 stored in the memory 21 may also be divided into one or more program modules, which are stored in the memory 21 and executed by one or more processors (in this embodiment, the processor 22) to complete the present invention.
For example, fig. 6 is a schematic diagram of program modules of the second embodiment of implementing the priority-based mail sending apparatus 20, in which the priority-based mail sending apparatus 20 may be divided into an obtaining module 200, a calculating module 202, a generating module 204, a sorting module 206, and a parsing and sending module 208. The program modules referred to herein are a series of computer program instruction segments that can perform specific functions, and are more suitable than programs for describing the execution process of the priority-based mail sending apparatus 20 in the computer device 2. The specific functions of the program modules 200-208 have been described in detail in the second embodiment, and are not described herein again.
Example four
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer-readable storage medium of this embodiment is used for storing a computer program, and when executed by a processor, implements the priority-based mail sending method of the first embodiment.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A priority-based method for sending a mail, comprising:
monitoring various types of mails;
establishing a timing task to record the sending success time and the reading receipt time of various mails;
acquiring the sending success time and the reading receipt time of various mails within a preset time period;
calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm, and regularly refreshing the priority of the mail based on the latest data;
acquiring mails to be sent in a current time period, and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises a priority corresponding to the mail;
caching the mail sending requests in a request queue, and sequencing the mail sending requests in the request queue according to the priority of the mail sending requests;
and reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests, and sending the mails according to the mail data obtained after analysis.
2. The priority-based mail transmission method according to claim 1, wherein the buffering the mail transmission requests in a request queue, and the sorting the mail transmission requests in the request queue according to the priority of the mail transmission requests comprises:
sorting the mail sending requests in the request queue according to the priority and the cache time of the mail sending requests; wherein, the first and the second end of the pipe are connected with each other,
for the mail sending requests with different priorities, the mail sending request with low priority is ranked in front of the mail sending request with high priority;
for the mail sending requests with the same priority, the mail sending request with the earlier cache time is ranked before the mail sending request with the later cache time.
3. The priority-based mail sending method according to claim 1, wherein the reading of the mail sending requests from the request queue in sequence, the parsing of the mail sending requests, and the sending of the mail according to the mail data obtained after the parsing comprises:
creating a mail sending thread;
judging whether the position of the last read mail sending request is the last position of the request queue or not according to the mail sending thread, if so, returning to the first position of the request queue to read the mail sending request, and if not, starting to read the mail sending request from the next position of the last read position;
and analyzing the mail sending request based on the mail sending thread, and calling an application programming interface of a mail server to send the mail according to the mail data obtained after analysis.
4. The priority-based mail transmission method according to claim 3, wherein the steps of reading the mail transmission requests from the request queue in sequence, analyzing the mail transmission requests, and transmitting the mails according to the mail data obtained after the analysis comprise:
judging whether the mail is sent successfully or not through the mail sending thread;
if the transmission is successful, deleting the mail transmission request corresponding to the mail from the request queue;
if the transmission fails, deleting the mail transmission request corresponding to the mail from the request queue, and then re-caching the mail transmission request in the request queue and sequencing.
5. The priority-based mail transmission method according to claim 1, further comprising:
when sending the mails in the next time period, acquiring the unsent mails in the current time period and the newly added sent mails in the next time period;
and determining the priority of the newly added sent mails, and reordering the sending requests corresponding to the newly added sent mails and the unsent mails in the request queue according to the priority.
6. The priority-based mail transmission method according to claim 1, further comprising:
and caching the mail sending request and at least one mail in the mail sending request and the priority corresponding to the mail into a block chain.
7. A priority-based mail transmission apparatus, comprising:
the acquisition module is used for monitoring various mails; establishing a timing task to record the sending success time and the reading receipt time of various mails; acquiring the sending success time and the reading receipt time of various mails within a preset time period;
the calculation module is used for calculating the priority of each type of mail according to the sending success time, the reading receipt time and a preset priority algorithm, and regularly refreshing the priority of the mail based on the latest data;
the generating module is used for acquiring mails to be sent in the current time period and generating a mail sending request of each mail according to the mails to be sent, wherein the mails to be sent comprise at least one mail, and the mail sending request comprises a priority corresponding to the mail;
the sorting module is used for caching the mail sending request in a request queue and sorting the mail sending requests in the request queue according to the priority of the mail sending request;
and the analysis sending module is used for reading the mail sending requests from the request queue in sequence, analyzing the mail sending requests and sending mails according to the mail data obtained after analysis.
8. A computer arrangement, characterized in that the computer arrangement comprises a memory, a processor, the memory having stored thereon a computer program being executable on the processor, the computer program, when being executed by the processor, realizing the steps of the priority-based mail transmission method according to any of the claims 1-6.
9. A computer-readable storage medium, having stored thereon a computer program, the computer program being executable by at least one processor to cause the at least one processor to perform the steps of the priority-based mail sending method according to any of claims 1-6.
CN202011040403.0A 2020-09-28 2020-09-28 Priority-based mail sending method, device, equipment and storage medium Active CN112134790B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011040403.0A CN112134790B (en) 2020-09-28 2020-09-28 Priority-based mail sending method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011040403.0A CN112134790B (en) 2020-09-28 2020-09-28 Priority-based mail sending method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112134790A CN112134790A (en) 2020-12-25
CN112134790B true CN112134790B (en) 2023-04-14

Family

ID=73843095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011040403.0A Active CN112134790B (en) 2020-09-28 2020-09-28 Priority-based mail sending method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112134790B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783851A (en) * 2004-12-03 2006-06-07 国际商业机器公司 An email transaction system and method
CN103401764A (en) * 2013-08-05 2013-11-20 浪潮(北京)电子信息产业有限公司 Method and device for sending mails
CN110380949A (en) * 2019-05-24 2019-10-25 平安普惠企业管理有限公司 Intranet e-mail sending method, device, computer equipment and storage medium
CN111526081A (en) * 2020-03-16 2020-08-11 中国平安人寿保险股份有限公司 Mail forwarding method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7698369B2 (en) * 2004-05-27 2010-04-13 Strongmail Systems, Inc. Email delivery system using metadata on emails to manage virtual storage
US20090113016A1 (en) * 2007-10-24 2009-04-30 Subhabrata Sen Managing email servers by prioritizing emails

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783851A (en) * 2004-12-03 2006-06-07 国际商业机器公司 An email transaction system and method
CN103401764A (en) * 2013-08-05 2013-11-20 浪潮(北京)电子信息产业有限公司 Method and device for sending mails
CN110380949A (en) * 2019-05-24 2019-10-25 平安普惠企业管理有限公司 Intranet e-mail sending method, device, computer equipment and storage medium
CN111526081A (en) * 2020-03-16 2020-08-11 中国平安人寿保险股份有限公司 Mail forwarding method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112134790A (en) 2020-12-25

Similar Documents

Publication Publication Date Title
CN109873904B (en) User message state reporting processing method, device and storage medium for message pushing
CN111835467B (en) Message sending method, device, computer equipment and storage medium
CN111756601B (en) Microservice architecture monitoring method and device, computer equipment and readable storage medium
CN110719318B (en) Message processing method and system
CN111585867A (en) Message processing method and device, electronic equipment and readable storage medium
CN111756644B (en) Hot spot current limiting method, system, equipment and storage medium
CN108833443B (en) Message transmission method and system and computer equipment
CN114546681A (en) Kafka-based message processing method, device, equipment and storage medium
CN113038396A (en) Scheduling method, device and equipment of short message channel and storage medium
CN110333916B (en) Request message processing method, device, computer system and readable storage medium
CN112134790B (en) Priority-based mail sending method, device, equipment and storage medium
CN112437001B (en) Method and device for guaranteeing reliable delivery and consumption of messages
US11194637B2 (en) Extensible alerts platform
CN111884769B (en) Message synchronization method and device
CN112969198A (en) Data transmission method, terminal and storage medium
CN112865927B (en) Message delivery verification method, device, computer equipment and storage medium
CN112148387A (en) Method and device for preloading feedback information, computer equipment and storage medium
CN116151929A (en) Order cooperative processing method, device, equipment and medium based on message queue
US20090138479A1 (en) System and method for sending data storing requests in sequence
WO2023043370A2 (en) Method and apparatus for sending logs, and log management system
CN111488236B (en) Order exception processing method, server, storage medium and processing device
CN108880994B (en) Method and device for retransmitting mails
CN110362464B (en) Software analysis method and equipment
CN110909086A (en) Mail archiving method, system, computer device and computer readable storage medium
CN112333262A (en) Data updating prompting method and device, computer equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant