Summary of the invention
The present invention provides a kind of e-mail sending method, device and system, for solving number of mail is more, to send the frequency high
In the case where, mailbox server can not cope with mail flood, and then the problem of influence mail delivery.
The present invention provides a kind of e-mail sending method comprising:
Mail data is received by hypertext transfer protocol layer and is forwarded to code layer;
If triggering mail sending strategy according to mail data in code layer, refuses to send and be transmitted to hypertext
Protocol layer returns to notice;
If not triggering mail sending strategy according to mail data in code layer, mail data is sent to mail
It sends layer and carries out mail transmission.
Further, mail sending strategy includes: to send interval time strategy;
If triggering mail sending strategy according to mail data in code layer, refusal sends and transmits to hypertext and assists
The step of view layer returns to notice further comprises:
If being less than or equal to preset time threshold from the transmission interval time of the mail of same account, refusal is sent
And the notice that refusal is sent is returned to hypertext transfer protocol layer.
Further, mail sending strategy includes: maximum mail quantity forwarded strategy;
If triggering mail sending strategy according to mail data in code layer, refusal sends and transmits to hypertext and assists
The step of view layer returns to notice further comprises:
If the single number of mail from same account has been more than preset quantity threshold value, refusal sends and to hypertext
Transportation protocol layer returns to the notice that refusal is sent.
Further, mail sending strategy includes: delegated strategy;
If triggering mail sending strategy according to mail data in code layer, refusal sends and transmits to hypertext and assists
The step of view layer returns to notice further comprises:
If having received the mail data of unauthorized account, refusal, which sends and returns to hypertext transfer protocol layer, to be refused
The notice of transmission.
Further, the step of receiving mail data by hypertext transfer protocol layer further comprises:
Receive the mail data sent by hypertext transfer protocol interface to hypertext transfer protocol layer;Wherein, user
It is interacted by http protocol and hypertext transfer protocol interface.
The present invention also provides a kind of mail sending devices comprising:
Hypertext transfer protocol layer module, suitable for receiving mail data and being forwarded to code layer module;
Code layer module, if refusal sends and to hypertext suitable for triggering mail sending strategy according to mail data
Transportation protocol layer module returns to notice;If not triggering mail sending strategy according to mail data, mail data is sent to
Mail sends layer module;
Mail sends layer module, is adapted for mail transmission.
Further, code layer module further comprises:
Send interval time policy module, if the transmission interval time suitable for the mail from same account be less than or
Equal to preset time threshold, refusal sends and returns to the notice that refusal is sent to hypertext transfer protocol layer module.
Further, code layer module further comprises:
Maximum mail quantity forwarded policy module, if being more than pre- suitable for the single number of mail from same account
If amount threshold, refusal sends and returns to the notice that refusal is sent to hypertext transfer protocol layer module.
Further, code layer module further comprises:
Delegated strategy module, if refusal sends and to hypertext suitable for the mail data for having received unauthorized account
Transportation protocol layer module returns to the notice that refusal is sent.
Further, hypertext transfer protocol layer module is further adapted for: being received through hypertext transfer protocol interface to super
The mail data that Text Transfer Protocol layer is sent;Wherein, user is handed over by http protocol and hypertext transfer protocol interface
Mutually.
The present invention provides a kind of mail transmission system again comprising: mail sending device, client and mail of the invention
Server;
Client is suitable for: mail data is sent to hypertext transfer protocol layer module by hypertext transfer protocol interface,
And it is interacted by http protocol and hypertext transfer protocol interface;
Mail server is suitable for: receiving mail and sends the mail data of layer module transmission and carry out mail delivery.
E-mail sending method provided by the invention, device and system send the client and mail service of mail in user
Mail public service system is separately set between device, mail public service system gives postal using preset mail sending strategy
Part server bring mail flood solves the problems, such as that mail server rejects mail and then influences mail delivery, mail clothes
Business device is no longer influenced by the influence of mail flood.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
Fig. 1 is the flow diagram of the e-mail sending method of the embodiment of the present invention one, as shown in Figure 1, the postal of embodiment one
Part sending method includes:
Step S101 receives mail data by hypertext transfer protocol layer and is forwarded to code layer.
Step S102, if triggering mail sending strategy according to mail data in code layer, refuse send and to
Hypertext transfer protocol layer returns to notice.
Step S103, if not triggering mail sending strategy according to mail data in code layer, by mail data
It is sent to mail and sends layer progress mail transmission.
Specifically, mail data is included exploitation code (as Mail Contents) to be sent using mail he and developed
Other additional informations such as the addressee, sender, the sending time that are embedded in code.It is configured between client and mail server
Mail public service (Mail Service) first sends out mail when user sends mail to mail server by client
It send to mail public service and is handled, then the mail for meeting customized strategy is sent to mail service by mail public service
Device.Wherein, mail public service can be deployed on the server or service cluster between client and mail server.Postal
The framework of part public service includes following three layers:
First layer is hypertext transfer protocol layer (HTTP, Hypertext Transfer Protocol), and user is in client
When end sends mail, call http protocol interface that mail data is sent to hypertext transfer protocol layer by program language;It is super
After Text Transfer Protocol layer receives mail data, parameter testing is carried out;If each parameter of mail data is complete, postal will not influence
Part is delivered, and mail data is sent to code layer processing;If mail data lacks certain parameters and influences mail delivery, refusal
Mail sends and passes through the notice and reason that hypertext transfer protocol interface sends failure to client feedback mail.
The second layer is code layer (Code), code layer by the mail data sent based on hypertext transfer protocol interface with it is simple
Single Mail Transfer protocol matches, and the received mail data of hypertext transfer protocol layer is made to meet the number of Simple Mail Transfer protocol
According to specification, mail delivery is carried out in order to which mail data is sent to mail server later.Wherein, it is equipped with and makes by oneself in code layer
The mail sending strategy of justice is to control the reception of mail data.Mail sending strategy can be set to control mail send quantity,
Frequency only sends the mail etc. of authorized user, such as the frequency sent using interval time policy control mail is sent, using most
The quantity that big mail quantity forwarded policy control mail is sent, the mail etc. of authorized user is only sent using delegated strategy, above-mentioned
Three mail sending strategys will specifically describe in example 2, and details are not described herein again.In mail transmission process, first by mail
It is uniformly sent to mail public service, then in mail public service, postal is carried out by the mail sending strategy in code layer
The controls such as part filtering.Therefore, be all not in that quantity forwarded is excessive, send out from the mail that mail public service reaches mail server
The problem that frequency is excessively high is sent, is not in mail flood phenomenon in mail server.In addition, code layer is also used to database friendship
Mutually, achievement data calculating etc..
Third layer is that mail sends layer, for being interacted with mail server, the mail that will be controlled by mail sending strategy
Data are sent to mail server by Simple Mail Transfer protocol, in order to which mail server is to addressee's delivering mail.
The embodiment of the present invention one provide e-mail sending method, user send mail client and mail server it
Between separately set mail public service, mail public service is brought using preset mail sending strategy to avoid to mail server
Mail flood, solve the problems, such as that mail server rejects mail and then influences mail delivery, mail server is no longer influenced by
The influence of mail flood.
In addition, being sent in the prior art for realization mail, it is necessary to install mail and send software, programmer need to call mail to send out
Software is sent to send mail, this mode height relies on mail and sends software.Mail transmission software needs accomplish and mail server
Match, when mail transmission software is used for a long time, software is easy to appear problem, equally also influences mail delivery.To this present invention
The e-mail sending method that embodiment one provides only calls mail public service to achieve that mail is sent out by HTTP function interface
It send, mail public service is transparent to user and convenient for centralized management, does not need that mail is called to send software, reduces pair
The dependence of mail transmission software.
Fig. 2 is the flow diagram of the e-mail sending method of the embodiment of the present invention two, as shown in Fig. 2, the postal of embodiment two
Part sending method includes:
Step S201 receives the mail data sent by hypertext transfer protocol interface to hypertext transfer protocol layer;
Wherein, user is interacted by http protocol and hypertext transfer protocol interface.
For example, user calls mail utility to send mail, institute by Curl language and http protocol interactive interfacing
The mail data of transmission is the exploitation code to be sent based on http protocol for being embedded in Curl language, wherein to be sent
Exploitation code is Mail Contents, and the Curl language of insertion indicates other additional informations of mail.Curl language supports the upper of file
It passes and downloads, be a comprehensive transmission tool.In Curl language, sender is indicated by " from ", addressee is indicated by " to "
People indicates Mail Contents by " body ".Wherein, mail public service is deployed in the Post between client and mail server
On Fix server, Post Fix is MTA (the mail transmission generation developed under the GPL agreement of IBM by Wietse Venema
Reason) software.When user sends mail, mail data is sent to Post Fix using http protocol interface in client first and is taken
The hypertext transfer protocol layer of the mail public service of business device.
In practical applications, if programmer user needs a large amount of exploitation code issuing addressee by mail batch
People, it is not necessary to it calls mail to send software as prior art and sends in batches, but directly in the exploitation code for needing to transmit
Curl verbal order is added, specifically: sender is indicated by " from ", addressee is indicated by " to ", passes through " body " table
Show Mail Contents, indicates that mail sends order by specified function (such as send function).Then utilize http protocol interface will
The exploitation code (i.e. mail data) for being added to Curl verbal order is sent to the hypertext transfer protocol layer of mail public service.
Step S202, forwarding by mail data to code layer.
Specifically, after hypertext transfer protocol layer receives mail data, parameter testing is carried out: if each ginseng of mail data
It counts up to whole, will not influence mail delivery, mail data is forwarded to code layer processing;If mail data lack certain parameters and
Mail delivery is influenced, refusal mail, which sends and passes through hypertext transfer protocol interface, sends the logical of failure to client feedback mail
Know and reason.Wherein, code layer is equipped with mail sending strategy, and mail sending strategy includes: to send interval time strategy, maximum postal
Part quantity forwarded strategy, delegated strategy.
Step S203, if being less than or equal to preset time threshold from the transmission interval time of the mail of same account
Value, refusal send and return to the notice that refusal is sent to hypertext transfer protocol layer.
Specifically, the trigger condition for sending interval time strategy is the transmission interval time of the mail from same account
Less than or equal to preset time threshold.When code layer receives mail, the account of mail sender is obtained, according to sender's
The same account of account inquiries sends the time interval of mail, when time interval is less than or equal to preset time threshold, triggering hair
It send interval time tactful, refuses the transmission of this mail.If certain user has sent a large amount of mails within a short period of time, mail is sent
Frequency is excessively high, and being sent directly to mail server will be filtered and refuse to send, at this point, by sending interval time policy control
It is sent to the transmission frequency of mail server, avoids mail server that mail flood occurs, and then avoid other hairs of same period
The normal email of part people is delivered.
Step S204 refuses to send out if the single number of mail from same account has been more than preset quantity threshold value
It send and returns to the notice that refusal is sent to hypertext transfer protocol layer.
Specifically, the trigger condition of maximum mail quantity forwarded strategy is super from the single number of mail of same account
Preset quantity threshold value is crossed.When code layer receives mail, the account of mail sender is obtained, is looked into according to the account of sender
The quantity that account single sends mail is ask, when the quantity that single sends mail has been more than preset quantity threshold value, triggering is maximum
Mail quantity forwarded strategy refuses the transmission of this mail.If certain user's single sends mail, mass mailings are had sent, directly
Receiving and sending to mail server will be filtered and refuse to send, and be sent to mail clothes by maximum mail quantity forwarded policy control
The number of mail of business device, avoids mail server that mail flood occurs, and then avoid the normal postal of other senders of same period
Part is delivered.
Step S205, if having received the mail data of unauthorized account, refusal sends and to hypertext transfer protocol
Layer returns to the notice that refusal is sent.
Specifically, the trigger condition of delegated strategy is the mail data for having received unauthorized account.Pass through delegated strategy
Account with power of attorney is set, when the mail that code layer receives is not that account with power of attorney is sent, triggering delegated strategy refusal is sent, thus
The quantity that can send the account of mail to mail server is controlled, avoids mail server that mail flood occurs.
In addition to above-mentioned three kinds of mail sending strategys, other customized strategies can also be arranged to control in code layer in user
Mail is sent, and network administrator can be facilitated to carry out pipe to mail transmission by setting customized strategy in mail public service
Reason and monitoring.
Step S206 sends out mail data if not triggering mail sending strategy according to mail data in code layer
It send to mail and sends layer progress mail transmission.
Specifically, if mail data in code layer by when the monitoring of whole mail sending strategys, illustrating to send at this time
Quantity, the frequency of mail are mail server acceptables, at this time by mail send layer call post fix software to
Mail server send mail, mail server is not in mail flood phenomenon, will not there is a situation where reject mail.?
After success sends mail to mail server, mail sends layer and mail is sent successfully notice return code layer, and code layer will
The mail sends successfully notice and returns to hypertext transfer protocol layer, and hypertext transfer protocol layer passes through HTTP interface to client
It returns to the mail and sends successfully notice, to notify user mail to send successfully.
E-mail sending method provided by Embodiment 2 of the present invention sends interval time strategy, maximum mail hair by setting
Quantity strategy, delegated strategy are sent, frequency, quantity and the account quantity for sending mail to mail server is controlled, avoids mail
Mail flood phenomenon occurs for server, and then solves the problems, such as that mail server rejects mail and influences mail delivery.In addition,
Mail public service is transparent to user and convenient for centralized management, does not need to send software by means of mail, reduce pair
The dependence of mail transmission software.
Fig. 3 is the structural schematic diagram of the mail sending device of the embodiment of the present invention three, as shown in figure 3, the postal of embodiment three
Part sending device includes:
Hypertext transfer protocol layer module 301, suitable for receiving mail data and being forwarded to code layer module 302.
Code layer module 302, if refusal is sent and Xiang Chaowen suitable for triggering mail sending strategy according to mail data
This transportation protocol layer module 301 returns to notice;If not triggering mail sending strategy according to mail data, mail data is sent out
It send to mail and sends layer module 303.
Mail sends layer module 303, is adapted for mail transmission.
The mail sending device that the embodiment of the present invention three provides is the e-mail sending method that the embodiment of the present invention one provides
Realization device, the e-mail sending method that concrete principle reference implementation example one provides, details are not described herein again.
The mail sending device that the embodiment of the present invention three provides sends the client and mail server of mail set on user
Between, and solve mail clothes using preset mail sending strategy to avoid mail server bring mail flood is given
The problem of business device rejects mail and then influences mail delivery, mail server is no longer influenced by the influence of mail flood.
In addition, the mail sending device that the embodiment of the present invention three provides is transparent to user and convenient for managing concentratedly,
It does not need to send software by means of mail, reduces the dependence for sending software to mail.
Fig. 4 is the structural schematic diagram of the mail sending device of the embodiment of the present invention four, as shown in figure 4, the postal of example IV
Part sending device includes:
Hypertext transfer protocol layer module 401, suitable for receiving mail data and being forwarded to code layer module 402.Hypertext
Transportation protocol layer module 401 is further adapted for: being received and is passed through hypertext transfer protocol interface to hypertext transfer protocol layer module
401 mail datas sent;Wherein, user is interacted by http protocol and hypertext transfer protocol interface.
Code layer module 402, if refusal is sent and Xiang Chaowen suitable for triggering mail sending strategy according to mail data
This transportation protocol layer module 401 returns to notice;If not triggering mail sending strategy according to mail data, mail data is sent out
It send to mail and sends layer module 403.
Mail sends layer module 403, is adapted for mail transmission.
Wherein, code layer module 402 further comprises:
Interval time policy module 4021 is sent, if the transmission interval time suitable for the mail from same account is small
In or equal to preset time threshold, refusal transmission is simultaneously to the notice of the return refusal transmission of hypertext transfer protocol layer module 401.
Maximum mail quantity forwarded policy module 4022, if being more than suitable for the single number of mail from same account
Preset quantity threshold value, refusal, which is sent, simultaneously returns to the notice that refusal is sent to hypertext transfer protocol layer module 401.
Delegated strategy module 4023, if refusal sends and to super suitable for the mail data for having received unauthorized account
Text Transfer Protocol layer module 401 returns to the notice that refusal is sent.
The mail sending device that the embodiment of the present invention four provides is e-mail sending method provided by Embodiment 2 of the present invention
Realization device, the e-mail sending method that concrete principle reference implementation example two provides, details are not described herein again.
The mail sending device that the embodiment of the present invention four provides, by sending interval time policy module, maximum mail hair
Quantity policy module, delegated strategy module are sent, frequency, quantity and the account quantity for sending mail to mail server are controlled,
It avoids mail server that mail flood phenomenon occurs, and then solves mail server and reject mail and influence asking for mail delivery
Topic.In addition, the mail sending device that the embodiment of the present invention four provides is transparent to user and convenient for centralized management, do not need
Software is sent by means of mail, reduces the dependence for sending software to mail.
Fig. 5 is the structural schematic diagram of the mail transmission system of the embodiment of the present invention five, as shown in figure 5, the postal of embodiment five
It includes: mail sending device 300, client 501 and mail server 502 shown in Fig. 3 that part, which sends system,;
Client 501 is suitable for: sending mail to hypertext transfer protocol layer module 301 by hypertext transfer protocol interface
Data, and interacted by http protocol and hypertext transfer protocol interface;
Mail server 502 is suitable for: receiving mail and sends the mail data of the transmission of layer module 303 and carry out mail delivery.
The mail transmission system that the embodiment of the present invention five provides is using present invention mail sending device shown in Fig. 3, tool
Body principle refers to mail sending device shown in Fig. 3, and details are not described herein again.
The mail transmission system that the embodiment of the present invention five provides passes through the mail being set between client and mail server
Sending device, and solve postal using preset mail sending strategy to avoid mail server bring mail flood is given
The problem of part server rejects mail and then influences mail delivery, mail server is no longer influenced by the influence of mail flood.
In addition, the mail transmission system in the embodiment of the present invention five is transparent to user and convenient for centralized management, no
It needs to send software by means of mail, reduces the dependence for sending software to mail.
Fig. 6 is the structural schematic diagram of the mail transmission system of the embodiment of the present invention six, as shown in fig. 6, the postal of embodiment six
It includes: mail sending device 400, client 601 and mail server 602 shown in Fig. 4 that part, which sends system,;
Client 601 is suitable for: sending mail to hypertext transfer protocol layer module 401 by hypertext transfer protocol interface
Data, and interacted by http protocol and hypertext transfer protocol interface;
Mail server 602 is suitable for: receiving mail and sends the mail data of the transmission of layer module 403 and carry out mail delivery.
The mail transmission system that the embodiment of the present invention six provides is using present invention mail sending device shown in Fig. 4, tool
Body principle refers to mail sending device shown in Fig. 4, and details are not described herein again.
The mail transmission system that the embodiment of the present invention six provides, by sending interval time policy module, maximum mail hair
Quantity policy module, delegated strategy module are sent, frequency, quantity and the account quantity for sending mail to mail server are controlled,
It avoids mail server that mail flood phenomenon occurs, and then solves mail server and reject mail and influence asking for mail delivery
Topic.
In addition, the mail transmission system in the embodiment of the present invention six is transparent to user and convenient for centralized management, no
It needs to send software by means of mail, reduces the dependence for sending software to mail.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein.
Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various
Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention
Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect
Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself
All as a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment
Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any
Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed
All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors
Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice
Microprocessor or digital signal processor (DSP) are realized in mail sending device according to an embodiment of the present invention and system
The some or all functions of some or all components.The present invention is also implemented as executing method as described herein
Some or all device or device programs (for example, computer program and computer program product).Such reality
Existing program of the invention can store on a computer-readable medium, or may be in the form of one or more signals.
Such signal can be downloaded from an internet website to obtain, and perhaps be provided on the carrier signal or in any other forms
It provides.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability
Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch
To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame
Claim.