[go: up one dir, main page]

CN112737926B - Mail sending method and device, electronic equipment and storage medium - Google Patents

Mail sending method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112737926B
CN112737926B CN202011642629.8A CN202011642629A CN112737926B CN 112737926 B CN112737926 B CN 112737926B CN 202011642629 A CN202011642629 A CN 202011642629A CN 112737926 B CN112737926 B CN 112737926B
Authority
CN
China
Prior art keywords
mail
sent
sending
target
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
CN202011642629.8A
Other languages
Chinese (zh)
Other versions
CN112737926A (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 Securities Co Ltd
Original Assignee
Ping An Securities Co Ltd
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 Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN202011642629.8A priority Critical patent/CN112737926B/en
Publication of CN112737926A publication Critical patent/CN112737926A/en
Application granted granted Critical
Publication of CN112737926B publication Critical patent/CN112737926B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/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)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a mail sending method, which relates to the technical field of clouds, wherein the method comprises the following steps: in the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent; performing content processing on the mail to be sent, performing business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal; in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule; and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending. The embodiment of the application is beneficial to improving the stability of mail sending.

Description

Mail sending method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of mail service architecture, and in particular, to a method and apparatus for sending mail, an electronic device, and a storage medium.
Background
Mail is not only a bridge for enhancing the communication between enterprises and clients, but also one of the effective tools for the communication inside the enterprises, and plays an indispensable role in daily work. The sending of the mail in the internal system of the enterprise depends on the mail service technology, and the traditional internal system of the enterprise usually adopts a synchronous mode for sending the mail, namely, after calling an interface of the internal system or related tools, the internal system converts parameters and then synchronously sends a request to an upstream mail service platform. However, this synchronous processing method is very dependent on the stability of the upstream mail server, and once a problem occurs upstream, the system cannot send the mail for a period of time, so that the stability of the current mail sending method needs to be improved.
Disclosure of Invention
In order to solve the problems, the application provides a mail sending method, a mail sending device, electronic equipment and a storage medium, which are beneficial to improving the stability of mail sending.
An embodiment of the present application provides a mail sending method, where the method includes:
in the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent;
Performing content processing on the mail to be sent, performing business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal;
in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule;
and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending.
With reference to the first aspect, in a possible implementation manner, the performing content processing on the mail to be sent includes:
variable replacement, destination address filtering and public service data processing are carried out on the mail to be sent;
the variable substitutions include a first type of variable substitution and a second type of variable substitution; the variable replacement of the mail to be sent comprises the following steps:
aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced;
and performing replacement operation on the variable replacement of the second type by adopting the set of for-loop processing variables.
With reference to the first aspect, in a possible implementation manner, the method further includes:
if the content processing is abnormal or the business rule processing is abnormal, performing state turnover on the mail to be sent;
the step of performing state turnover on the mail to be sent comprises the following steps:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
With reference to the first aspect, in a possible implementation manner, the retrieving the mail to be sent from the prefire queue includes:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
and taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent.
With reference to the first aspect, in one possible implementation manner,
the step of taking out the target mail to be sent from the prefire queue according to the preset level of the target mail to be sent comprises the following steps:
if the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
If the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
With reference to the first aspect, in a possible implementation manner, the adding the mail to be sent to a sending pool queue to send includes:
when the mail to be sent of the target is obtained from the sending pool queue, reading a routing configuration;
if the target mail to be sent is an outgoing mail, sending the target mail by a routing outgoing implementation class;
if the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform according to the drop point score to send;
If the target internal mail sending service platforms with the sending quantity exceeding the upper limit of the route configuration in unit time exist, the target internal mail sending service platforms do not participate in the calculation of the drop point scores, the internal mail sending service platforms which do not exceed the upper limit of the route configuration participate in route selection, and finally one internal mail sending service platform is selected for sending according to the drop point scores;
if the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
With reference to the first aspect, in a possible implementation manner, the method further includes:
and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
A second aspect of an embodiment of the present application provides a mail sending apparatus, including:
the system comprises a sending request acquisition module, a sending request processing module and a sending request processing module, wherein the sending request acquisition module is used for acquiring a mail sending request submitted by a service end through a target interface in a producer process, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting sending of a mail to be sent;
The mail processing module is used for carrying out content processing on the mail to be sent, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefixed pool queue under the condition that the business rule processing is not abnormal;
the mail extraction module is used for taking out the mail to be sent from the pre-sending pool queue in the consumer process, and auditing the mail to be sent by utilizing a pre-sending pool rule;
and the mail sending module is used for adding the mail to be sent into a sending pool queue for sending under the condition that the pre-sending pool rule audit is passed.
A third aspect of the embodiments of the present application provides an electronic device, including an input device and an output device, and further including a processor adapted to implement one or more instructions; the method comprises the steps of,
a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the steps of the method of the first aspect described above.
A fourth aspect of the embodiments of the present application provides a computer storage medium storing one or more instructions adapted to be loaded by a processor and to perform the steps of the method of the first aspect described above.
Compared with the prior art, in the process of the producer, the embodiment of the application acquires the mail sending request submitted by the service end through the target interface, and logs the mail sending request, wherein the mail sending request is used for requesting to send the mail to be sent; carrying out content processing on the mail to be sent, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the rule processing is not abnormal; in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule; and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending. In this way, the mail service is divided into two parts of a producer and a consumer by the distributed scheduling technology, the dependence on the upstream stability is reduced, meanwhile, the problem of abnormal mail sending caused by downstream instability is solved by setting the prefire pool, the stability of mail sending is improved, in addition, the operations of content processing and rule processing of the producer part, prefire pool rule checking of the consumer part and the like are all favorable for reducing the possibility of abnormal mail sending, and therefore the mail can be accurately sent.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a network system architecture diagram provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of a mail sending method according to an embodiment of the present application;
fig. 3 is an exemplary diagram of a mail template to be sent according to an embodiment of the present application;
fig. 4 is a flow chart of another mail sending method according to an embodiment of the present application;
FIG. 5 is an exemplary diagram of a producer portion provided in accordance with an embodiment of the present application;
FIG. 6 is an exemplary diagram of a consumer portion provided by an embodiment of the present application;
fig. 7 is a schematic structural diagram of a mail sending device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
The terms "comprising" and "having" and any variations thereof, as used in the description, claims and drawings, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used for distinguishing between different objects and not for describing a particular sequential order.
The embodiment of the application provides a mail sending scheme, which adopts the design concept of a producer consumer model, the mail service is divided into two parts for implementing decoupling, a database is used as a storage medium of a mail queue, a pre-sending pool is introduced into a consumer part, mails subjected to content processing are added into the pre-sending pool, only the mails which are checked by the rule of the pre-sending pool enter the sending pool for sending, and the mails with abnormal or error sending are intercepted in the pre-sending pool. The whole scheme design is favorable for solving the stability problem of mail sending, decoupling among all parts or modules, flexibly supports later-stage expansion, can add a receiver newly when a mail sending request is higher than a receiving end, can add a consumer newly to accelerate consumption when the mail needing to be consumed is higher than a consuming end, and meets high concurrency demands, thereby being favorable for ensuring that system mails in enterprises can be accurately sent.
Specifically, the mail sending scheme may be implemented based on the network system shown in fig. 1, and as shown in fig. 1, the network system includes a service end, a (mail) receiving end, a database, a (mail) consuming end and a mail server, where each part communicates through a network connection, and a network protocol adopted in the communication may be a TCP/IP protocol or a netbeeui protocol, which is not limited specifically. The service end can call an interface exposed by the receiving end to submit a mail sending request, the receiving end performs parameter preservation, state recording, content processing and the like on the mail submitted by the service end, under the condition that all the processing of the mail is not abnormal, the mail is transferred to a mail queue (for example, a pre-sending pool queue) of a database, the consuming end takes out the mail from the mail queue, performs verification before sending, adds the verified mail into another mail queue (for example, a sending pool queue), and finally pushes the mail in the other mail queue to a corresponding mail service platform, and the mail server sends the mail. The receiving end and the consuming end in the network system are decoupled, and are provided with the exception handling module, so that the abnormal mail can be sent out, and remedial measures are added for the mail sending request of the service end.
Based on the network system shown in fig. 1, the mail sending method according to the embodiment of the present application is described in detail below with reference to the related drawings, referring to fig. 2, fig. 2 is a schematic flow chart of the mail sending method according to the embodiment of the present application, as shown in fig. 2, including steps S21-S24:
s21, in the process of the producer, acquiring a mail sending request submitted by a service end through a target interface, and logging the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent.
In the specific embodiment of the application, the mail service adopts a micro-service architecture spring closed whole home barrel related technology stack for design and development, the producer process is the producer part of the producer consumer model, the service end is the request party for sending the mail, and mainly refers to the enterprise internal system for calling the mail service, for example: an alarm system, a project system, a manuscript system, etc.; the target interface refers to a restful interface exposed by the receiving end, and the mail to be sent is the mail that the service party needs to send, and the service party can submit a mail sending request through the restful interface, wherein the mail sending request comprises parameters necessary for sending the mail to be sent.
After the mail sending request submitted by the service end is obtained, the receiving end uniformly performs log record operation, and mainly comprises the steps of storing parameters of the mail sending request into a database, storing attachments in the mail to be sent into the database, and performing state record on the mail to be sent. The method and the system have the advantages that the parameters are saved in the database, so that when the processing of the mail to be sent is abnormal, the mail sending request can be retransmitted through the log record, and the situation that no remedial measures are taken when the abnormality occurs is avoided.
S22, carrying out content processing on the mail to be sent, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal.
In a specific embodiment of the present application, after log recording is completed for a mail to be sent submitted by a service party, content processing is performed, specifically, content processing includes various aspects such as variable replacement, destination address filtering, public service data processing, etc., as shown in a mail template in fig. 3, variable replacement is mainly performed for a variable { docName }, in a mail subject or a mail body, after a mail request comes, the variable { docName } is uniformly replaced with a name required by a specific service, and destination address filtering is mainly performed for a recipient, an address of a sender, for example: screening of off-staff, and public service data processing mainly aims at processing forms, documents (for example, project responsible person, decision opinion and the like which meet naming standards) and the like in the attachment/tag description.
If the content processing of each aspect of the mail to be sent is not abnormal, processing the business rule of the mail to be sent, wherein the rule is a custom rule in a business system, for example: part of service systems need to send out the same mail at different time points, and then the processing rule is to generate a plurality of pre-sending records, so if the mail to be sent out is needed to be sent out at different time points, whether the pre-sending records of the mail to be sent out are generated or not is needed to be determined; and part of service systems need to send certain mail at regular time, so that a regular sending task can be generated, and the regular sending also belongs to the service rule. It can be understood that, if no abnormality occurs in the mail to be sent in the rule processing stage, the mail to be sent may be added to the prefire queue, and the prefire queue may be understood as a cache queue of the mail to be sent.
S23, in the consumer process, taking out the mail to be sent from the pre-sending pool queue, and auditing the mail to be sent by utilizing a pre-sending pool rule.
In a specific embodiment of the application, the consumer process, i.e., the consumer portion of the producer consumer model, and the functions of the consumer portion, such as mail auditing, mail sending, and logging, are implemented based on the distributed scheduling framework xxl-job. The prefire pool is a queue with priority and time characteristics, the priority refers to the emergency degree (comprising emergency, ordinary and low) of the mail transmitted by the downstream system (business end) in the mail service, the processing sequence of the mail in the queue is determined, if no priority is required, the mail is defaulted to ordinary; the time characteristic is that when the downstream system sends a mail request, the downstream system can specify the sending time, belongs to the function of timing sending, and if the downstream system does not specify the sending time, the sending time defaults to the current time.
In one possible implementation manner, the retrieving the mail to be sent from the prefire queue includes:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
and taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent.
In a specific embodiment of the present application, a target mail to be sent is a mail to be sent at a current time, and first, the sending time of all the mails to be sent in the pre-sending pool queue is screened, the target mail to be sent is determined, and the target mail to be sent is fetched from the pre-sending pool queue according to a preset level (emergency degree) of the target mail to be sent.
In one possible implementation manner, the retrieving the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent includes:
if the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
In the specific embodiment of the application, the preset weighted proportion of the urgent, normal and low three preset levels is 5:3:2, namely the upper limit of the proportion of the target mail to be sent, which is taken by the urgent level, in all the taken target mails to be sent is 5, and the upper limit of the normal level is 3 and the upper limit of the low level is 2. And if the number of the target mails to be sent at each level in the pre-sending pool queue just meets 5:3:2, taking out N target mails to be sent according to the proportion, wherein N can be customized. For example: the number of the target mails to be sent corresponding to the three preset levels in the pre-sending pool queue is 75/45/30 respectively, the upper limit of the preset weighting proportion is 5:3:2, and if N is 100, the number of the target mails to be sent, which are correspondingly fetched by the three levels, is 50/30/20 respectively. It may be appreciated that, when the number of target mail to be sent corresponding to a certain preset level in the urgent, normal, and low preset levels in the preset pool queue does not meet the preset weight ratio upper limit, determining the certain preset level as a target preset level, for example: the number of the target mails to be sent corresponding to the three levels is 25/125/40 respectively, the emergency level is determined as a target preset level, 25 packages lacking in the emergency level are supplemented by the target mails to be sent corresponding to the common level when the mails are taken, the common level of 30 is changed to 55, namely, the taking method of the three levels is 25/55/20, and finally 100 target mails to be sent are taken out. And if the total number of the target mails to be sent in the pre-sending pool queue does not reach N, taking out all the target mails to be sent. In this embodiment, the data is taken according to the weighted proportion, rather than completely through the priority, mainly considering that if the high priority mail of the service end is sent in a lot, the sending of the common low-level mail to be sent is blocked, the high priority sending can be ensured through the proportion control, meanwhile, the normal sending of the mails of other levels can be ensured, the blocking is avoided, and meanwhile, a filling mechanism is provided, so that the condition that the processing efficiency is low due to the insufficient quantity of a certain level is avoided.
The review of the prefire pool rules includes manual review, keyword review, threshold review, exception review, etc., such as: blocking a blacklist in keyword auditing, and enterprise high-level management generally does not care about reminding mails sent by a system, so that mails sent to the people by the system are blocked and filtered, if the mails are not the mails sent to the people, the blocking is not carried out, and the auditing is passed; for another example: blocking the abnormal mail, empty content mail and program processing abnormal mail caused by business Bug or other reasons in abnormal auditing, if the abnormal mail belongs to the categories, auditing is not passed; for another example: in the threshold auditing, mails of the same receiver, content and subject are added into a prefire pool queue or sent for a certain time, namely intercepted, the mails are not audited, so that endless circulation is avoided, and the mails are sent continuously. Each prefire pool rule corresponds to an implementation class, the implementation class implements an interface defined by the prefire pool rule, and each prefire pool rule needs to implement rule definition as follows: 1. the scope of influence of the rule (all/all exclusives/designations); 2. an object for which the rule is directed (mail template, such as YIMB-200000 in fig. 3); 3. the object of rule audit (mail content/recipient/mail number); 4. the rule auditing values (such as auditing keywords) are merely illustrative of the prefire pool rules, and do not limit the scheme, and the prefire pool rules can be expanded according to actual business needs.
And S24, adding the mail to be sent into a sending pool queue for sending under the condition that the pre-sending pool rule audit is passed.
In the specific embodiment of the application, under the condition that all the pre-sending pool rule audits pass, the target mail to be sent is added into the sending pool queue, and the consumption end pushes the mail to the mail service platform for sending according to the sending type (such as internal sending and external sending) of the target mail to be sent. And the sending pool queue, serving as the whole calling outlet of the mail service, is butted with a plurality of upstream mail channels, and divides the added target mails to be sent into internal mails/external mails according to different service scenes. In the scheme, a routing function is introduced to carry out route management on a mail service platform, the routing function is the core of mail sending, and an Adapter determines to which platform each target mail to be sent is pushed to send through configuration of routing rules.
In one possible implementation, when the target mail to be sent is obtained from the sending pool queue, the routing configuration is read, and if the target mail to be sent is an outgoing mail, the sending is performed through a routing outgoing implementation class. If the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula parseInt (platform weight summation) according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform to send according to the drop point score. For example: the platform A weight 50, the platform B weight 100 and the platform C weight 50 (platform A/B/C are all internal mail service platforms) are configured, the platform weight is added up to 200, then the drop point score is obtained through a random number formula, and then judgment processing is carried out: if the score is within the range of 0-50, the selected platform A sends, if the score is within the range of 51-150, the selected platform B sends, and if the score is within the range of 151-200, the selected platform C sends. If the target internal mail service platforms with the number exceeding the upper limit of the route configuration exist in unit time, the target internal mail service platforms do not participate in the calculation of the drop point scores, the internal mail service platforms which do not exceed the upper limit of the route configuration participate in the route selection, and finally one internal mail service platform is selected for sending according to the drop point scores. For example: if the number of mails sent by the platform A in unit time exceeds the upper limit of the route configuration, the platform A does not participate in the calculation of the drop point score, and the platform B and the platform C participate in the route selection. If the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
It can be seen that in the process of the producer, the embodiment of the application obtains the mail sending request submitted by the service end through the target interface, and logs the mail sending request, wherein the mail sending request is used for requesting to send the mail to be sent; carrying out content processing on the mail to be sent, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the rule processing is not abnormal; in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule; and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending. In this way, the mail service is divided into two parts of a producer and a consumer by the distributed scheduling technology, the dependence on the upstream stability is reduced, meanwhile, the problem of abnormal mail sending caused by downstream instability is solved by setting the prefire pool, the stability of mail sending is improved, in addition, the operations of content processing and rule processing of the producer part, prefire pool rule checking of the consumer part and the like are all favorable for reducing the possibility of abnormal mail sending, and therefore the mail can be accurately sent.
Referring to fig. 4, fig. 4 is a flowchart of another mail sending method according to an embodiment of the present application, as shown in fig. 4, including steps S41-S45:
s41, in the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and logging the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent;
s42, carrying out content processing on the mail to be sent, wherein the content processing comprises variable replacement, destination address filtering and public service data processing; the variable substitutions include a first type of variable substitution and a second type of variable substitution; aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced; performing a replacement operation with respect to the second type of variable replacement using a set of for-loop process variables;
s43, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal;
S44, in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule;
and S45, adding the mail to be sent into a sending pool queue for sending under the condition that the pre-sending pool rule audit is passed.
In a specific embodiment of the present application, the first type of variable substitution is a common variable substitution, for example: for variable replacement of mail subject and mail body, the second type of variable replacement is table-based variable replacement. For common variable replacement, matching variable contents to be replaced (for example, { docName }) by adopting a regular expression, and executing replacement operation on the variable contents to be replaced; for table-based variable replacement, a replacement operation is performed using a set of for-loop process variables (e.g., a set of fields in a table). In terms of variable replacement, the Adapter mode is adopted to encapsulate variable replacement, the implementation method of all variable related implementation classes is defined through interfaces, the implementation class of each Adapter implements the interfaces, and then the implementation of the implementation class is registered on the Adapter. In the main flow, the content to be sent is identified, the adapter is called to execute replacement according to the identification result, and finally various variable processing is completed. In this embodiment, the design of variable substitution facilitates the extension of subsequent variable substitution, and when there are new variable substitutions to be developed, there are only two places to modify, one where content identification is implemented and the other where the interface to implement substitution develops the alternative adapter implementation class.
In addition, since the data sources of variable substitution are relatively diverse, it mainly includes: 1. data directly transmitted by a downstream system; 2. data which is configured in the template and needs to be queried from different data tables; 3. data configured in the dictionary table; 4. default data variables in mail service; therefore, the same realization mode of variable replacement is adopted on the data source for obtaining the variable replacement, and the adapter mode is adopted, and the processing is carried out through interface definition, class realization interface realization and adapter registration. Each data source has one implementation class corresponding to the processing, the main flow enters the implementation class allocated by the adapter through the identification of the content of the module, reads corresponding data, adds the corresponding data into the whole variable replacement object, and prepares the data for the variable replacement.
In one possible embodiment, the method further comprises:
if the content processing is abnormal or the business rule processing is abnormal, performing state turnover on the mail to be sent;
the step of performing state turnover on the mail to be sent comprises the following steps:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
In a specific embodiment of the present application, as shown in fig. 5, in addition to several major operations of log recording, content processing and rule processing, the producer part is further provided with an abnormal retransmission mechanism, records and stores an abnormal state of a mail to be sent, which is abnormal in the content processing or rule processing, and periodically scans the mail to be sent, if the mail to be sent is a mail meeting retransmission conditions, for example: since the upstream connection condition, the internal service condition, and the like are determined to be abnormal, the mail sending request of the mail for the mail to be sent is re-submitted, and the mail is added into the prefire queue until no abnormality occurs in the content processing and the rule processing. In this embodiment, the method records the abnormal state of the mail to be sent, which is determined to be abnormal by the producer, and triggers the abnormal retransmission mechanism to enter the retransmission flow, so as to solve the problem that the mail cannot be sent out due to abnormal mail when the mail is sent out and is high.
In one possible embodiment, the method further comprises:
and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
In a specific embodiment of the present application, as shown in fig. 6, the consumer part takes out the mail to be sent from the prefire queue of the prefire, inspects the prefire rule of the prefire, joins the sending pool queue, takes out the mail to be sent from the sending pool queue by the sending pool consumer, sends out (internal sending or external sending), logs the sent mail according to the state returned by the upstream mail service platform, triggers the abnormal resending operation for the mail with abnormal sending state, reenters the prefire pool queue, and carries out record modification for the mail with normal sending so as to ensure that each mail in the sending pool queue can be sent normally.
It should be noted that, in the embodiment shown in fig. 4, some steps have been described in the embodiment shown in fig. 2, and in order to avoid repetition, a description is omitted here.
Based on the description of the method embodiments above, the embodiments of the present application also provide a mail sending apparatus, which may be a computer program (including program code) running in a terminal. The mail sending device may perform the method shown in fig. 2 or fig. 4. Referring to fig. 7, the apparatus includes:
a sending request obtaining module 71, configured to obtain, in a producer process, a mail sending request submitted by a service end through a target interface, and log the mail sending request, where the mail sending request is used to request sending of a mail to be sent;
A mail processing module 72, configured to perform content processing on the mail to be sent, perform business rule processing on the mail to be sent if no abnormality occurs in the content processing, and add the mail to be sent to a prefire queue if no abnormality occurs in the business rule processing;
a mail extraction module 73, configured to, in a consumer process, take out the mail to be sent from the prefire queue, and audit the mail to be sent by using a prefire rule;
and the mail sending module 74 is configured to add the mail to be sent to a sending pool queue for sending if the pre-sending pool rule audit passes.
In an alternative embodiment, in terms of content processing of the mail to be sent, the mail processing module 72 is specifically configured to:
variable replacement, destination address filtering and public service data processing are carried out on the mail to be sent; the variable substitutions include a first type of variable substitution and a second type of variable substitution;
in terms of performing variable replacement on the mail to be sent, the mail processing module 72 is specifically configured to:
aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced;
And performing replacement operation on the variable replacement of the second type by adopting the set of for-loop processing variables.
In an alternative embodiment, the mail processing module 72 is further configured to perform a state flip on the mail to be sent if an abnormality occurs in the content processing or an abnormality occurs in the business rule processing;
in terms of status flipping the mail to be sent, the mail processing module 72 is specifically configured to:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
In an alternative embodiment, in terms of retrieving the mail to be sent from the prefire queue, the mail extracting module 73 is specifically configured to:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
and taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent.
In an alternative embodiment, in terms of retrieving the target to-be-sent mail from the prefire queue according to the preset level of the target to-be-sent mail, the mail extracting module 73 is specifically configured to:
If the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
In an alternative embodiment, in terms of adding the mail to be sent to a sending pool queue for sending, the mail sending module 74 is specifically configured to:
when the mail to be sent of the target is obtained from the sending pool queue, reading a routing configuration;
if the target mail to be sent is an outgoing mail, sending the target mail by a routing outgoing implementation class;
if the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform according to the drop point score to send;
If the target internal mail sending service platforms with the sending quantity exceeding the upper limit of the route configuration in unit time exist, the target internal mail sending service platforms do not participate in the calculation of the drop point scores, the internal mail sending service platforms which do not exceed the upper limit of the route configuration participate in route selection, and finally one internal mail sending service platform is selected for sending according to the drop point scores;
if the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
In an alternative embodiment, mail processing module 72 is further configured to: and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
According to an embodiment of the present application, each unit in the mail sending apparatus shown in fig. 7 may be separately or completely combined into one or several other units, or some unit(s) thereof may be further split into a plurality of units having smaller functions, which may achieve the same operation without affecting the achievement of the technical effects of the embodiment of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the mail sending device may also include other units, and in practical applications, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of a plurality of units.
According to another embodiment of the present application, an apparatus device as shown in fig. 7 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 or fig. 4 on a general-purpose computing device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and implementing the above-described methods of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and executed by the above-described computing device via the computer-readable recording medium.
Based on the description of the method embodiment and the device embodiment, the embodiment of the application also provides electronic equipment. Referring to fig. 8, the electronic device includes at least a processor 81, an input device 82, an output device 83, and a computer storage medium 84. Wherein the processor 81, input device 82, output device 83, and computer storage medium 84 within the electronic device may be connected by a bus or other means.
The computer storage medium 84 may be stored in a memory of the electronic device, the computer storage medium 84 being for storing a computer program comprising program instructions, the processor 81 being for executing the program instructions stored by the computer storage medium 84. The processor 81, or CPU (Central Processing Unit ), is a computing core as well as a control core of the electronic device, which is adapted to implement one or more instructions, in particular to load and execute one or more instructions to implement a corresponding method flow or a corresponding function.
In one embodiment, the processor 81 of the electronic device provided in the embodiment of the present application may be configured to perform a series of mail sending processes, including:
in the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent;
performing content processing on the mail to be sent, performing business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal;
in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule;
and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending.
In one embodiment, the processor 81 performs the content processing on the mail to be sent, including: variable replacement, destination address filtering and public service data processing are carried out on the mail to be sent;
The variable substitutions include a first type of variable substitution and a second type of variable substitution; the variable replacement of the mail to be sent comprises the following steps:
aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced;
and performing replacement operation on the variable replacement of the second type by adopting the set of for-loop processing variables.
In one embodiment, the processor 81 is further configured to: if the content processing is abnormal or the business rule processing is abnormal, performing state turnover on the mail to be sent;
the processor 81 performs the state inversion on the mail to be sent, including:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
In one embodiment, the processor 81 executing the fetching of the mail to be sent from the prefire queue includes:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
And taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent.
In one embodiment, the processor 81 executes the fetching of the target mail to be sent from the prefire queue according to the preset level of the target mail to be sent, including:
if the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
In one embodiment, the processor 81 performs the sending of the mail to be sent by adding the mail to be sent to a sending pool queue, including:
when the mail to be sent of the target is obtained from the sending pool queue, reading a routing configuration;
If the target mail to be sent is an outgoing mail, sending the target mail by a routing outgoing implementation class;
if the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform according to the drop point score to send;
if the target internal mail sending service platforms with the sending quantity exceeding the upper limit of the route configuration in unit time exist, the target internal mail sending service platforms do not participate in the calculation of the drop point scores, the internal mail sending service platforms which do not exceed the upper limit of the route configuration participate in route selection, and finally one internal mail sending service platform is selected for sending according to the drop point scores;
if the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
In one embodiment, the processor 81 is further configured to: and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
By way of example, the electronic device may be a server, cloud server, or the like. The electronic devices may include, but are not limited to, a processor 81, an input device 82, an output device 83, and a computer storage medium 84. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of an electronic device and is not limiting of an electronic device, and may include more or fewer components than shown, or certain components may be combined, or different components.
It should be noted that, since the steps in the mail sending method described above are implemented when the processor 81 of the electronic device executes the computer program, the embodiments of the mail sending method described above are applicable to the electronic device, and the same or similar advantageous effects can be achieved.
The embodiment of the application also provides a computer storage medium (Memory), which is a Memory device in the electronic device and is used for storing programs and data. It will be appreciated that the computer storage medium herein may include both a built-in storage medium in the terminal and an extended storage medium supported by the terminal. The computer storage medium provides a storage space that stores an operating system of the terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor 81. The computer storage medium herein may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory; alternatively, it may be at least one computer storage medium located remotely from the aforementioned processor 81. In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by processor 81 to implement the corresponding steps described above with respect to the mail sending method; in particular implementations, one or more instructions in a computer storage medium are loaded by processor 81 and perform the steps of:
In the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent;
performing content processing on the mail to be sent, performing business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal;
in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule;
and under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
and carrying out variable replacement, destination address filtering and public service data processing on the mail to be sent.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
Aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced;
and performing replacement operation on the variable replacement of the second type by adopting the set of for-loop processing variables.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
if the content processing is abnormal or the business rule processing is abnormal, performing state turnover on the mail to be sent;
in one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
and taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
if the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
when the mail to be sent of the target is obtained from the sending pool queue, reading a routing configuration;
if the target mail to be sent is an outgoing mail, sending the target mail by a routing outgoing implementation class;
If the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform according to the drop point score to send;
if the target internal mail sending service platforms with the sending quantity exceeding the upper limit of the route configuration in unit time exist, the target internal mail sending service platforms do not participate in the calculation of the drop point scores, the internal mail sending service platforms which do not exceed the upper limit of the route configuration participate in route selection, and finally one internal mail sending service platform is selected for sending according to the drop point scores;
if the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 81, further perform the steps of:
and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
It should be noted that, since the steps in the mail sending method described above are implemented when the computer program of the computer storage medium is executed by the processor, all the embodiments or implementations of the mail sending method described above are applicable to the computer storage medium, and the same or similar beneficial effects can be achieved.
The foregoing has outlined rather broadly the more detailed description of embodiments of the application, wherein the principles and embodiments of the application are explained in detail using specific examples, the above examples being provided solely to facilitate the understanding of the method and core concepts of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (8)

1. A mail sending method, characterized in that the method comprises:
in the process of a producer, acquiring a mail sending request submitted by a service end through a target interface, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting to send a mail to be sent; the producer process is the producer portion of a producer consumer model;
Performing content processing on the mail to be sent, performing business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefire queue under the condition that the business rule processing is not abnormal;
in the consumer process, taking out the mail to be sent from the prefire pool queue, and auditing the mail to be sent by utilizing the prefire pool rule; the producer process and the consumer process form two parts of a mail service, and decoupling is carried out between the producer process and the consumer process; the consumer process is the consumer part of the producer consumer model;
under the condition that the pre-sending pool rule audit is passed, adding the mail to be sent into a sending pool queue for sending;
the step of taking out the mail to be sent from the pre-sending pool queue comprises the following steps:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent;
the step of taking out the target mail to be sent from the prefire queue according to the preset level of the target mail to be sent comprises the following steps:
If the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
2. The method of claim 1, wherein the content processing of the mail to be sent comprises:
variable replacement, destination address filtering and public service data processing are carried out on the mail to be sent;
the variable substitutions include a first type of variable substitution and a second type of variable substitution; the variable replacement of the mail to be sent comprises the following steps:
aiming at the variable replacement of the first type, matching the variable content to be replaced by adopting a regular expression, and executing replacement operation on the variable content to be replaced;
And performing replacement operation on the variable replacement of the second type by adopting the set of for-loop processing variables.
3. The method according to claim 1, wherein the method further comprises:
if the content processing is abnormal or the business rule processing is abnormal, performing state turnover on the mail to be sent;
the step of performing state turnover on the mail to be sent comprises the following steps:
and carrying out abnormal recording on the mail to be sent, periodically scanning the mail to be sent, and adding the mail to be sent into the pre-sending pool queue if the mail to be sent accords with a preset resending condition.
4. The method of claim 1, wherein the adding the mail to be sent to a send pool queue for sending includes:
when the mail to be sent of the target is obtained from the sending pool queue, reading a routing configuration;
if the target mail to be sent is an outgoing mail, sending the target mail by a routing outgoing implementation class;
if the target mail to be sent is an internal mail, judging whether the sending quantity of all internal mail service platforms in unit time does not exceed the upper limit of route configuration, if so, calculating by adopting a random number formula according to the weight of each internal mail service platform of route configuration to obtain a drop point score, and selecting the internal mail service platform according to the drop point score to send;
If the target internal mail sending service platforms with the sending quantity exceeding the upper limit of the route configuration in unit time exist, the target internal mail sending service platforms do not participate in the calculation of the drop point scores, the internal mail sending service platforms which do not exceed the upper limit of the route configuration participate in route selection, and finally one internal mail sending service platform is selected for sending according to the drop point scores;
if the sending quantity of all the internal mail service platforms exceeds the route configuration upper limit, waiting for the internal mail service platform which does not exceed the route configuration upper limit to execute the operation of drop point score calculation and route selection.
5. The method according to claim 1, wherein the method further comprises:
and writing back the sending state of the mail to be sent according to the state returned by the upstream mail service platform so as to carry out log record, adding the mail to be sent into the pre-sending pool queue again to carry out retransmission operation under the condition that the sending state is abnormal, and carrying out log record modification under the condition that the sending state of the retransmission operation is normal.
6. A mail sending device, characterized in that the device comprises:
the system comprises a sending request acquisition module, a sending request processing module and a sending request processing module, wherein the sending request acquisition module is used for acquiring a mail sending request submitted by a service end through a target interface in a producer process, and carrying out log record on the mail sending request, wherein the mail sending request is used for requesting sending of a mail to be sent; the producer process is the producer portion of a producer consumer model;
The mail processing module is used for carrying out content processing on the mail to be sent, carrying out business rule processing on the mail to be sent under the condition that the content processing is not abnormal, and adding the mail to be sent into a prefixed pool queue under the condition that the business rule processing is not abnormal;
the mail extraction module is used for taking out the mail to be sent from the pre-sending pool queue in the consumer process, and auditing the mail to be sent by utilizing a pre-sending pool rule; the producer process and the consumer process form two parts of a mail service, and decoupling is carried out between the producer process and the consumer process; the consumer process is the consumer part of the producer consumer model;
the mail sending module is used for adding the mail to be sent into a sending pool queue for sending under the condition that the pre-sending pool rule audit is passed;
the mail extraction module is specifically configured to:
determining a target mail to be sent from the pre-sending pool queue according to the sending time;
taking out the target mail to be sent from the pre-sending pool queue according to the preset level of the target mail to be sent;
The mail extraction module is specifically configured to:
if the total number of the target mails to be sent reaches a preset value and the number of the target mails to be sent corresponding to each preset level just meets the upper limit of a preset weighting proportion, N mails to be sent of the target are taken out according to the preset weighting proportion;
if the total number of the target mails to be sent reaches a preset value and a target preset level exists, and the number of the target mails to be sent corresponding to the target preset level does not reach the upper limit of a preset weighting proportion, supplementing the number of the target mails to be sent, which is missing from the target preset level, with the target mails to be sent corresponding to the preset level with the largest number when the target mails to be sent are taken out, so as to take out N target mails to be sent.
7. An electronic device comprising an input device and an output device, further comprising:
a processor adapted to implement one or more instructions; the method comprises the steps of,
a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the steps of the method of any of claims 1-5.
8. A computer storage medium storing one or more instructions adapted to be loaded by a processor and to perform the steps of the method of any of claims 1-5.
CN202011642629.8A 2020-12-30 2020-12-30 Mail sending method and device, electronic equipment and storage medium Active CN112737926B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011642629.8A CN112737926B (en) 2020-12-30 2020-12-30 Mail sending method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011642629.8A CN112737926B (en) 2020-12-30 2020-12-30 Mail sending method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112737926A CN112737926A (en) 2021-04-30
CN112737926B true CN112737926B (en) 2023-11-24

Family

ID=75609169

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011642629.8A Active CN112737926B (en) 2020-12-30 2020-12-30 Mail sending method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112737926B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113595887B (en) * 2021-09-09 2023-03-24 北京天空卫士网络安全技术有限公司 Flow control method and device in mail system
CN114244800A (en) * 2021-12-01 2022-03-25 北京计算机技术及应用研究所 E-mail monitoring and early warning method and system
CN114979056B (en) * 2022-05-20 2023-12-29 甬矽电子(宁波)股份有限公司 E-mail processing method and device, storage medium and electronic equipment
CN116545976B (en) * 2023-07-03 2024-01-19 深圳欧税通技术有限公司 Intelligent management method, system and readable storage medium for business mail

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1434393A (en) * 2003-02-24 2003-08-06 武汉大学 Dynamic loading balance method for cluster server
CN104506422A (en) * 2014-12-27 2015-04-08 宁波江东远通计算机有限公司 Mail sending and examining method and device
CN107888484A (en) * 2017-11-29 2018-04-06 北京明朝万达科技股份有限公司 A kind of email processing method and system
CN108600081A (en) * 2018-03-26 2018-09-28 北京明朝万达科技股份有限公司 A kind of method and device that mail outgoing achieves, Mail Gateway

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1434393A (en) * 2003-02-24 2003-08-06 武汉大学 Dynamic loading balance method for cluster server
CN104506422A (en) * 2014-12-27 2015-04-08 宁波江东远通计算机有限公司 Mail sending and examining method and device
CN107888484A (en) * 2017-11-29 2018-04-06 北京明朝万达科技股份有限公司 A kind of email processing method and system
CN108600081A (en) * 2018-03-26 2018-09-28 北京明朝万达科技股份有限公司 A kind of method and device that mail outgoing achieves, Mail Gateway

Also Published As

Publication number Publication date
CN112737926A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
CN112737926B (en) Mail sending method and device, electronic equipment and storage medium
US10511555B2 (en) Intelligent electronic mail server manager, and system and method for coordinating operation of multiple electronic mail servers
CN109213519B (en) Heterogeneous API adaptation processing method and system
CN102035684B (en) A kind of failure notification method and system
CN110333940A (en) Condition-based task scheduling method, device, equipment and storage medium
US20100235452A1 (en) Email wrong transmission preventing apparatus and method
JP3803707B2 (en) Framework system
CN110610376A (en) Behavior data response method and device, computer equipment and storage medium
CN112685107A (en) Workflow engine-based operation processing method, engine, electronic device and medium
CN101009666B (en) Email sending control system and method
CN110113257B (en) Unified data access gateway based on big data and implementation method
CN105897498A (en) Business monitoring method and device
CN110769056A (en) Real-name system information processing method and device, electronic equipment and storage medium
CN117149390A (en) Task scheduling method and device, electronic equipment and readable storage medium
CN114422467B (en) Customer service message management system and method
CN103384219B (en) E-mail sending method and system
CN116149762A (en) Function framework system, function operation method and function operation device
US11863525B2 (en) Contact passlisting across digital channels
CN111400058B (en) Method, device, computer equipment and storage medium for calling message
KR101808993B1 (en) System and method for sending message for priority messaging
CN111401819A (en) Intersystem data pushing method and system
CN114615696A (en) Automatic dial test method, device, system, server and storage medium
CN115757029A (en) Data processing method, device, equipment and storage medium
US20220245474A1 (en) Implementation of Rules in a Computing System
CN115065946B (en) Short message sending method, device, equipment and 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