Summary of the invention
The invention provides a kind of e-mail sending method, device and system, for solve many in number of mail, send the frequency high, mailbox server cannot tackle mail flood, and then affects the problem of mail delivery.
The invention provides a kind of e-mail sending method, it comprises:
Receive mail data by HTTP layer and be forwarded to code layer;
If trigger mail sending strategy according to mail data in code layer, then refusal sends and returns notice to HTTP layer;
If do not trigger mail sending strategy according to mail data in code layer, then mail data is sent to mail sending layer and carries out mail sending.
Further, mail sending strategy comprises: send strategy interval time;
If trigger mail sending strategy according to mail data in code layer, refusal sends and comprises further to the step that HTTP layer returns notice:
If the transmission coming from the mail of same account is less than or equal to preset time threshold interval time, refusal sends and returns the notice of refusal transmission to HTTP layer.
Further, mail sending strategy comprises: maximum mail sending quantity strategy;
If trigger mail sending strategy according to mail data in code layer, refusal sends and comprises further to the step that HTTP layer returns notice:
If the single number of mail coming from same account has exceeded predetermined number threshold value, refusal has sent and has returned the notice of refusal transmission to HTTP layer.
Further, mail sending strategy comprises: delegated strategy;
If trigger mail sending strategy according to mail data in code layer, refusal sends and comprises further to the step that HTTP layer returns notice:
If have received the mail data of unauthorized account, refusal sends and returns the notice of refusal transmission to HTTP layer.
Further, comprised further by the step of HTTP layer reception mail data:
Receive the mail data sent to HTTP layer by HTTP interface; Wherein, user is undertaken by http protocol and HTTP interface alternately.
The present invention also provides a kind of mail sending device, and it comprises:
HTTP layer module, is suitable for receiving mail data and being forwarded to code layer module;
Code layer module, if be suitable for triggering mail sending strategy according to mail data, refusal sends and returns notice to HTTP layer module; If do not trigger mail sending strategy according to mail data, mail data is sent to mail sending layer module;
Mail sending layer module, is suitable for carrying out mail sending.
Further, code layer module comprises further:
Send policy module interval time, if the transmission being suitable for the mail coming from same account is less than or equal to preset time threshold interval time, refusal sends and returns the notice of refusal transmission to HTTP layer module.
Further, code layer module comprises further:
The policy module of maximum mail sending quantity, if the single number of mail being suitable for coming from same account has exceeded predetermined number threshold value, refusal has sent and has returned the notice of refusal transmission to HTTP layer module.
Further, code layer module comprises further:
Delegated strategy module, if be suitable for the mail data that have received unauthorized account, refusal sends and returns the notice of refusal transmission to HTTP layer module.
Further, HTTP layer module is further adapted for: receive the mail data sent to HTTP layer by HTTP interface; Wherein, user is undertaken by http protocol and HTTP interface alternately.
The present invention provides again a kind of mail transmission system, and it comprises: mail sending device of the present invention, client and mail server;
Client is suitable for: send mail data by HTTP interface to HTTP layer module, and undertaken alternately by http protocol and HTTP interface;
Mail server is suitable for: receive the mail data of mail sending layer module transmission and carry out mail delivery.
E-mail sending method provided by the invention, device and system, send between the client of mail and mail server user and separately established mail public service system, mail public service system adopts the mail sending strategy preset to avoid the mail flood brought to mail server, solve the problem that mail server is rejected mail and then affected mail delivery, mail server is no longer subject to mail flood water mitigation.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to technological means of the present invention can be better understood, and can be implemented according to the content of specification, and can become apparent, below especially exemplified by the specific embodiment of the present invention to allow above and other objects of the present invention, feature and advantage.
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Fig. 1 is the schematic flow sheet of the e-mail sending method of the embodiment of the present invention one, and as shown in Figure 1, the e-mail sending method of embodiment one comprises:
Step S101, receives mail data by HTTP layer and is forwarded to code layer.
Step S102, if trigger mail sending strategy according to mail data in code layer, then refusal sends and returns notice to HTTP layer.
Step S103, if do not trigger mail sending strategy according to mail data in code layer, is then sent to mail sending layer and carries out mail sending by mail data.
Particularly, mail data comprises the exploitation code (as Mail Contents) and other additional information such as the addressee embedded in exploitation code, sender, transmitting time treating to send using mail he.Mail public service (MailService) is configured between client and mail server, when user sends mail by client to mail server, first processed to mail public service by mail sending, then mail public service will meet the mail sending of self-defined strategy to mail server.Wherein, mail public service can be deployed on server between client and mail server or service cluster.The framework of mail public service comprises following three layers:
Ground floor is HTTP layer (HTTP, HypertextTransferProtocol), and user, when client sends mail, calls http protocol interface by program language and mail data is sent to HTTP layer; HTTP layer carries out parameter testing after receiving mail data; If each parameter of mail data is complete, can not mail delivery be affected, mail data is sent to code layer process; If mail data lacks some parameter and affects mail delivery, refusal mail sending by HTTP interface to the notice of client feedback mail sending failure and reason.
The second layer is code layer (Code), the mail data sent based on HTTP interface and Simple Mail Transfer protocol match by code layer, the mail data that HTTP layer is received meets the data standard of Simple Mail Transfer protocol, so that afterwards mail data is sent to mail server to carry out mail delivery.Wherein, self-defining mail sending strategy is provided with in code layer to control the reception of mail data.Mail sending strategy can be set to the quantity, the frequency that control mail sending, only send the mail etc. of authorized user, such as utilize the frequency sending policy control mail sending interval time, utilize the quantity of maximum mail sending quantity policy control mail sending, delegated strategy is utilized only to send the mail etc. of authorized user, above-mentioned three mail sending strategies will specifically describe in embodiment two, repeat no more herein.In mail sending process, be first sent to mail public service by unified for mail, then in mail public service, carry out the controls such as filtrating mail by the mail sending strategy in code layer.Therefore, the mail arriving mail server from mail public service all there will not be the problem that quantity forwarded is too much, transmission frequency is too high, there will not be mail flood phenomenon at mail server.In addition, code layer also, achievement data calculating mutual for database etc.
Third layer is mail sending layer, for mutual with mail server, the mail data by mail sending policy control is sent to mail server by Simple Mail Transfer protocol, so that mail server is to addressee's delivering mail.
The e-mail sending method that the embodiment of the present invention one provides, send between the client of mail and mail server user and separately established mail public service, mail public service adopts the mail sending strategy preset to avoid the mail flood brought to mail server, solve the problem that mail server is rejected mail and then affected mail delivery, mail server is no longer subject to mail flood water mitigation.
In addition, for realizing mail sending in prior art, must install mail sending software, programmer need call mail sending software and send mail, and this mode height relies on mail sending software.Mail sending software needs to accomplish to match with mail server, and during Long-Time Service mail sending software, software easily goes wrong, and equally also affects mail delivery.To the e-mail sending method that this embodiment of the present invention one provides, call mail public service by means of only HTTP function interface and just can realize mail sending, mail public service is transparent to user and is convenient to centralized management, do not need to call mail sending software, reduce the dependence to mail sending software.
Fig. 2 is the schematic flow sheet of the e-mail sending method of the embodiment of the present invention two, and as shown in Figure 2, the e-mail sending method of embodiment two comprises:
Step S201, receives the mail data sent to HTTP layer by HTTP interface; Wherein, user is undertaken by http protocol and HTTP interface alternately.
Such as, user sends mail by Curl language and http protocol interactive interfacing to call public service of mail, the mail data sent is the exploitation code to be sent based on http protocol that embedded in Curl language, exploitation code wherein to be sent is Mail Contents, and the Curl language of embedding indicates other additional information of mail.The upload and download of Curl language supporting document is a comprehensive transmission instrument.In Curl language, represent sender by " from ", represent addressee by " to ", represent Mail Contents by " body ".Wherein, mail public service is deployed on the PostFix server between client and mail server, and PostFix is MTA (mail transport agent) software developed under the GPL agreement of IBM by WietseVenema.When user sends mail, first http protocol interface is utilized mail data to be sent to the HTTP layer of the mail public service of PostFix server in client.
In actual applications, if programmer user needs a large amount of exploitation codes to issue addressee by mail batch, mail sending software need not be called as prior art send in batches, but directly needing to add Curl verbal order in the exploitation code transmitted, be specially: represent sender by " from ", represent addressee by " to ", represent Mail Contents by " body ", represent mail sending order by specified function (such as send function).Then utilize http protocol interface that the exploitation code (i.e. mail data) that with the addition of Curl verbal order is sent to the HTTP layer of mail public service.
Step S202, forwarding by mail data are to code layer.
Particularly, HTTP layer carries out parameter testing: if each parameter of mail data is complete, can not affect mail delivery, mail data is forwarded to code layer process after receiving mail data; If mail data lacks some parameter and affects mail delivery, refusal mail sending by HTTP interface to the notice of client feedback mail sending failure and reason.Wherein, code layer is provided with mail sending strategy, and mail sending strategy comprises: send strategy interval time, maximum mail sending quantity strategy, delegated strategy.
Step S203, if the transmission coming from the mail of same account is less than or equal to preset time threshold interval time, refusal sends and returns the notice of refusal transmission to HTTP layer.
Particularly, the trigger condition sending strategy interval time is that the transmission of the mail coming from same account is less than or equal to preset time threshold interval time.When code layer receives mail, obtain the account of mail sending people, send the time interval of mail according to the same account of the account inquiries of sender, when the time interval is less than or equal to preset time threshold, trigger and send strategy interval time, refuse this mail sending.If user's within a short period of time have sent a large amount of mail, mail sending frequency is too high, directly be sent to mail server can be filtered and refuse to send, now, the transmission frequency of mail server is sent to by transmission policy control interval time, avoid mail server generation mail flood, and then avoid the normal email of same other sender of time period to deliver.
Step S204, if the single number of mail coming from same account has exceeded predetermined number threshold value, then refusal has sent and has returned the notice of refusal transmission to HTTP layer.
Particularly, the trigger condition of maximum mail sending quantity strategy is that the single number of mail coming from same account has exceeded predetermined number threshold value.When code layer receives mail, obtain the account of mail sending people, send the quantity of mail according to the account inquiries account single of sender, when the quantity that single sends mail has exceeded predetermined number threshold value, trigger maximum mail sending quantity strategy, refuse this mail sending.If when certain user's single sends mail, have sent mass mailings, directly be sent to mail server can be filtered and refuse to send, the number of mail of mail server is sent to by maximum mail sending quantity policy control, avoid mail server generation mail flood, and then avoid the normal email of same other sender of time period to deliver.
Step S205, if the mail data that have received unauthorized account, refusal sends and returns the notice of refusal transmission to HTTP layer.
Particularly, the trigger condition of delegated strategy is the mail data that have received unauthorized account.By delegated strategy, account with power of attorney is set, when the mail that code layer receives is not account with power of attorney transmission, trigger authorization strategy refusal sends, thus controls the quantity that can send the account of mail to mail server, avoids mail server generation mail flood.
Except above-mentioned three kinds of mail sending strategies, the self-defined strategy that user can also arrange other at code layer, to control mail sending, can facilitate network manager to carry out management and supervision to mail sending by setting self-defined strategy in mail public service.
Step S206, if do not trigger mail sending strategy according to mail data in code layer, is sent to mail sending layer and carries out mail sending by mail data.
Particularly, if when mail data passes through the monitoring of all mail sending strategies in code layer, illustrate that the quantity, the frequency that now send mail are all mail server acceptables, now call postfix software by mail sending layer and send mail to mail server, mail server there will not be mail flood phenomenon, and the situation rejecting mail also can not occur.After success sends mail to mail server, mail sending is successfully notified return code layer by mail sending layer, this mail sending successfully notifies to return HTTP layer by code layer, HTTP layer returns this mail sending by HTTP interface to client and successfully notifies, to notify that user mail sends successfully.
The e-mail sending method that the embodiment of the present invention two provides, strategy interval time, maximum mail sending quantity strategy, delegated strategy is sent by arranging, control and send the frequency of mail, quantity and account quantity to mail server, avoid mail server generation mail flood phenomenon, and then solve mail server and reject mail and affect the problem of mail delivery.In addition, mail public service is transparent to user and is convenient to centralized management, does not need, by means of mail sending software, to reduce the dependence to mail sending software.
Fig. 3 is the structural representation of the mail sending device of the embodiment of the present invention three, and as shown in Figure 3, the mail sending device of embodiment three comprises:
HTTP layer module 301, is suitable for receiving mail data and being forwarded to code layer module 302.
Code layer module 302, if be suitable for triggering mail sending strategy according to mail data, refusal sends and returns notice to HTTP layer module 301; If do not trigger mail sending strategy according to mail data, mail data is sent to mail sending layer module 303.
Mail sending layer module 303, is suitable for carrying out mail sending.
The implement device of the e-mail sending method that the mail sending device that the embodiment of the present invention three provides provides for the embodiment of the present invention one, the e-mail sending method that its concrete principle reference example one provides, repeats no more herein.
The mail sending device that the embodiment of the present invention three provides, being located at user sends between the client of mail and mail server, and adopt the mail sending strategy preset to avoid the mail flood brought to mail server, solve the problem that mail server is rejected mail and then affected mail delivery, mail server is no longer subject to mail flood water mitigation.
In addition, the mail sending device that the embodiment of the present invention three provides is transparent to user and is convenient to centralized management, does not need, by means of mail sending software, to reduce the dependence to mail sending software.
Fig. 4 is the structural representation of the mail sending device of the embodiment of the present invention four, and as shown in Figure 4, the mail sending device of embodiment four comprises:
HTTP layer module 401, is suitable for receiving mail data and being forwarded to code layer module 402.HTTP layer module 401 is further adapted for: receive the mail data sent to HTTP layer module 401 by HTTP interface; Wherein, user is undertaken by http protocol and HTTP interface alternately.
Code layer module 402, if be suitable for triggering mail sending strategy according to mail data, refusal sends and returns notice to HTTP layer module 401; If do not trigger mail sending strategy according to mail data, mail data is sent to mail sending layer module 403.
Mail sending layer module 403, is suitable for carrying out mail sending.
Wherein, code layer module 402 comprises further:
Send policy module interval time 4021, if the transmission being suitable for the mail coming from same account is less than or equal to preset time threshold interval time, refusal sends and returns the notice of refusal transmission to HTTP layer module 401.
Maximum mail sending quantity policy module 4022, if the single number of mail being suitable for coming from same account has exceeded predetermined number threshold value, refusal has sent and has returned the notice of refusal transmission to HTTP layer module 401.
Delegated strategy module 4023, if be suitable for the mail data that have received unauthorized account, refusal sends and returns the notice of refusal transmission to HTTP layer module 401.
The implement device of the e-mail sending method that the mail sending device that the embodiment of the present invention four provides provides for the embodiment of the present invention two, the e-mail sending method that its concrete principle reference example two provides, repeats no more herein.
The mail sending device that the embodiment of the present invention four provides, by sending policy module interval time, the policy module of maximum mail sending quantity, delegated strategy module, control and send the frequency of mail, quantity and account quantity to mail server, avoid mail server generation mail flood phenomenon, and then solve mail server and reject mail and affect the problem of mail delivery.In addition, the mail sending device that the embodiment of the present invention four provides is transparent to user and is convenient to centralized management, does not need, by means of mail sending software, to reduce the dependence to mail sending software.
Fig. 5 is the structural representation of the mail transmission system of the embodiment of the present invention five, and as shown in Figure 5, the mail transmission system of embodiment five comprises: the mail sending device 300 shown in Fig. 3, client 501 and mail server 502;
Client 501 is suitable for: send mail data by HTTP interface to HTTP layer module 301, and is undertaken alternately by http protocol and HTTP interface;
Mail server 502 is suitable for: receive the mail data of mail sending layer module 303 transmission and carry out mail delivery.
The mail transmission system that the embodiment of the present invention five provides adopts the mail sending device shown in Fig. 3 of the present invention, and its concrete principle, with reference to the mail sending device shown in figure 3, repeats no more herein.
The mail transmission system that the embodiment of the present invention five provides, by being located at the mail sending device between client and mail server, and adopt the mail sending strategy preset to avoid the mail flood brought to mail server, solve the problem that mail server is rejected mail and then affected mail delivery, mail server is no longer subject to mail flood water mitigation.
In addition, the mail transmission system in the embodiment of the present invention five is transparent to user and is convenient to centralized management, does not need, by means of mail sending software, to reduce the dependence to mail sending software.
Fig. 6 is the structural representation of the mail transmission system of the embodiment of the present invention six, and as shown in Figure 6, the mail transmission system of embodiment six comprises: the mail sending device 400 shown in Fig. 4, client 601 and mail server 602;
Client 601 is suitable for: send mail data by HTTP interface to HTTP layer module 401, and is undertaken alternately by http protocol and HTTP interface;
Mail server 602 is suitable for: receive the mail data of mail sending layer module 403 transmission and carry out mail delivery.
The mail transmission system that the embodiment of the present invention six provides adopts the mail sending device shown in Fig. 4 of the present invention, and its concrete principle, with reference to the mail sending device shown in figure 4, repeats no more herein.
The mail transmission system that the embodiment of the present invention six provides, by sending policy module interval time, the policy module of maximum mail sending quantity, delegated strategy module, control and send the frequency of mail, quantity and account quantity to mail server, avoid mail server generation mail flood phenomenon, and then solve mail server and reject mail and affect the problem of mail delivery.
In addition, the mail transmission system in the embodiment of the present invention six is transparent to user and is convenient to centralized management, does not need, by means of mail sending software, to reduce the dependence to mail sending software.
Intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with display at this algorithm provided.Various general-purpose system also can with use based on together with this teaching.According to description above, the structure constructed required by this type systematic is apparent.In addition, the present invention is not also for any certain programmed language.It should be understood that and various programming language can be utilized to realize content of the present invention described here, and the description done language-specific is above to disclose preferred forms of the present invention.
In specification provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this specification (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this specification (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary compound mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the some or all parts in the mail sending device of the embodiment of the present invention and system.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computer of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.