CN104601454B - Handle the method and system of mail - Google Patents

Handle the method and system of mail Download PDF

Info

Publication number
CN104601454B
CN104601454B CN201510078957.2A CN201510078957A CN104601454B CN 104601454 B CN104601454 B CN 104601454B CN 201510078957 A CN201510078957 A CN 201510078957A CN 104601454 B CN104601454 B CN 104601454B
Authority
CN
China
Prior art keywords
mail
request
time
sending
information
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
CN201510078957.2A
Other languages
Chinese (zh)
Other versions
CN104601454A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201510078957.2A priority Critical patent/CN104601454B/en
Publication of CN104601454A publication Critical patent/CN104601454A/en
Application granted granted Critical
Publication of CN104601454B publication Critical patent/CN104601454B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The present invention provides a kind of method and system for handling mail, and can multiple operation systems be provided with unified mail service.The method of the processing mail includes:Request for sending E-mail information is received, email template, posting address are specified in the request for sending E-mail information and it is expected to send the time of mail;According to the time generation mail requests header for it is expected to send mail and mail transmit queue is put into, and preserves the content of the request for sending E-mail information;Mail transmit queue described in poll and current time reach it is described it is expected to send the time of mail in the case of, mail is generated according to the email template and the request for sending E-mail information and the business datum of acquisition;The mail is sent to e-mail server, so that the e-mail server sends the mail to the posting address.

Description

Handle the method and system of mail
Technical field
The present invention relates to field of computer technology, a kind of particularly method and system for handling mail.
Background technology
In the related software in internet or system, it is often necessary to carry out the push of mail, mail pipe in specific occasion Reason system becomes the basis of most of the Internet, applications.In some applications, mail management system is as a submodule The support of mail transmission and management is provided for system, and in other applications, independent mail management module even be present, only It is the push for calling the mail API of correlation to carry out mail when business needs.
Because the ecological complexity of in internet itself, its corresponding mail service are also rich and varied.At present, most of applications A set of mailing system is each safeguarded, the mail push and management, mail transmission process and business being only customized for own service Itself has very high coupling, its poor universality, it is difficult to realize mail management module in variant application it is shared with Reuse.Although mail in each operation system with very strong customization, also has the similitude of height simultaneously.What is repeated opens Send out mail service intimate and cause the waste of substantial amounts of human and material resources, significantly increase software cost.
Meanwhile mail push logic is largely dispersed in each operation system, the maintenance to system causes very big difficulty. In many systems, mail is not the core of business, the coupling of the height of mail push logic often result in core business by In email error and failure.And time-consuming in itself for the transmission of mail, synchronous transmission tends to cause main business flow Obstruction, asynchronous transmission are difficult to confirm whether mail is successfully sent to again.With various, the mail that becomes increasingly abundant of network application ecology Itself also more show its business customizing characteristic.
In a kind of existing technical scheme, the transmission of mail is mainly by the JavaMail API provided or as base Plinth simplify the third party API (such as Commons Email) of encapsulation.Its detailed process is as follows:
1st, the association attributes that mail is sent is configured, including:Whether authentication (mail.smtp.auth), mail hair are needed Send the agreement (mail.transport.protocol-smtp) used;
The 2nd, the mail server information of distal end, including IP and port information are set;
3rd, mail session session is created;
4th, email message MineMessage is created according to session;
The 5th, theme and message body are set, message body must carry out different settings according to the content to be sent;If postal Annex is included in part, then to create multiple MimeMultipart objects, carry annex to be sent;
6th, set to send the account information of mail;
7th, create send mail Transport examples, establish connection (specify mail server, port, send account, Password);
8th, mail (specifying message body, and address list) is sent;
9th, session connection is closed.
Above step is repeatedly carried out when needing and sending mail in current most operation systems, or to above step Simplified package, different operation systems each repeat similar handling process, and its mail transmission process is cumbersome, function is weak, And it is difficult to unified management.
The content of the invention
In view of this, the present invention provides a kind of method and system for handling mail, can provide system to multiple operation systems One mail service.Other beneficial effects of technical solution of the present invention will be illustrated with reference to embodiment.
To achieve the above object, according to an aspect of the invention, there is provided a kind of method for handling mail.
The method of the processing mail of the present invention includes:Request for sending E-mail information is received, in the request for sending E-mail information Specify email template, posting address and it is expected to send the time of mail;It is expected that the time for sending mail generates according to described Mail requests header and mail transmit queue is put into, and preserves the content of the request for sending E-mail information;For mail The mail requests header specified in transmit queue, if the current expectation not reached in the mail requests header sends mail Time, the mail requests header is deleted in queue, so as to realize the corresponding mail of revocation;Mail described in poll sends team Arrange and in the case where current time reaches the time for it is expected transmission mail, according to the email template and the mail Send the business datum generation mail of solicited message and acquisition;The mail is sent to e-mail server, for this E-mail server sends the mail to the posting address.
Alternatively, after the step of mail being sent into e-mail server, in addition to:Receiving expression postal In the case that part sends the prompt message of failure, the transmission time again of mail is set, and sends time generation again according to this New mail requests head and it is put into the mail transmit queue.
According to another aspect of the present invention, there is provided a kind of system for handling mail.
The system of the processing mail of the present invention includes:Request reception unit, for receiving request for sending E-mail information, the postal Part, which is sent, to be specified email template, posting address and it is expected to send the time of mail in solicited message;Queue processing unit, For generating mail requests header according to the time for it is expected transmission mail and being put into mail transmit queue;For mail The mail requests header specified in transmit queue, if the current expectation not reached in the mail requests header sends mail Time, the mail requests header is deleted in queue, so as to realize the corresponding mail of revocation;Persistence unit, for inciting somebody to action The content of the request for sending E-mail information is saved in persistent storage device;Role management unit, for mail described in poll Transmit queue and current time reach it is described it is expected send mail time in the case of, call template resolution unit;Mould Plate resolution unit, for generating postal according to the email template and the request for sending E-mail information and the business datum of acquisition Part;Mailing List member, for the mail to be sent into e-mail server, so that the e-mail server is to described Posting address sends the mail.
Alternatively, the queue processing unit is multiple;The request reception unit is additionally operable in a manner of load balancing A queue processing unit is selected, the request for sending E-mail information is then transmitted to the queue processing unit.
Alternatively, the transmission object information that the Mailing List member is additionally operable to return to the e-mail server turns Issue the role management unit;The role management unit is additionally operable to represent that mail sends failure in the transmission object information In the case of, the transmission time again of mail is set, and the new mail requests head of time generation is sent according to this again and put Enter the mail transmit queue.
Technique according to the invention scheme, according to the request for sending E-mail information from operation system, to mail by transmission Queue is sent to e-mail server, realizes and multiple operation systems are provided with unified mail service.It is available in network Under the premise of, the implementation can provide the mail requests processing service concentrated for each scattered business, dynamically render mail mould Plate, asynchronous progress mail transmission, ensure that efficient, reliable mail is sent, simplify exploitation and management that mail sends business.And can According to business scale, progress is extending transversely, ensures that system is capable of the offer mail treatment service of high efficient and reliable.
Brief description of the drawings
Accompanying drawing is used to more fully understand the present invention, does not form inappropriate limitation of the present invention.Wherein:
Fig. 1 is the schematic diagram of the basic structure of the system of processing mail according to embodiments of the present invention;
Fig. 2 is the schematic diagram of the key step of the method for processing mail according to embodiments of the present invention.
Embodiment
The one exemplary embodiment of the present invention is explained below in conjunction with accompanying drawing, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize Arrive, various changes and modifications can be made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, the description to known function and structure is eliminated in following description.
In the technical scheme of the present embodiment, there is provided a mail treatment service, the service receive at the mail of client Reason request, and generate mail and then transfer to mail server to handle, multiple operation systems are provided with unified postal to realize with this Part service.Fig. 1 is the schematic diagram of the basic structure of the system of processing mail according to embodiments of the present invention.As shown in figure 1, processing The system 10 of mail is disposed as service, mainly includes request reception unit 11, queue processing unit 12, persistence unit 13rd, role management unit 14, template resolution unit 15 and Mailing List member 16.Also show in figure client 20 and its In client end AP I (application programming interface) unit 21 and query unit 22, mail transmit queue buffer unit, persistently Change memory cell 24, attachment files system 25 and mail server 26.Illustrate the embodiment of the present invention below in conjunction with Fig. 1 and Fig. 2 Processing mail method key step.Fig. 2 is the key step of the method for processing mail according to embodiments of the present invention Schematic diagram.
Step S201:Application system (not shown) calls client end AP I unit.It is incoming one when calling MailRequest mail requests objects, indicate email template, posting address to client and it is expected to send the time of mail Etc. information.
Step S202:Client end AP I unit verifies mail requests data, if shortage of data or illegal, into step S203, return to a prompt message;If data correctly if enter step S204.Client end AP I unit is to basis based on SMTP The mail API of agreement is packaged, and simplifies the encoder complexity of client (i.e. user program).
Step S204:Client end AP I unit calls web services, and request for sending E-mail information is sent into request receives list Member 11.Then service response is waited.Email template, posting address are specified in the request for sending E-mail information and it is expected hair Send the time of mail.The mode disposed as service enables the system 10 of processing mail to handle the operation system of any isomery The request for sending E-mail that middle client end AP I unit is sent.
Step S205:Request reception unit 11 receives request for sending E-mail information, is then forwarded to queue processing unit 12. Queue processing unit 12 can set multiple (1 is shown in figure), and such as to be multiple, then request reception unit 11 can be equal by load Then the mode of weighing apparatus therefrom selects a queue processing unit to the queue processing unit forwards request for sending E-mail information.Queue The mode of the multiple instances deployment of processing unit 12 helps to provide relatively reliable request processing service.Will request unloading enqueue, The mode of asynchronous transmission is waited to help to increase throughput of system.
Step S206:Queue processing unit 12 generates mail requests header according to the time for it is expected transmission mail and put Enter mail transmit queue.In the present embodiment, all request for sending E-mail are introduced into mail transmit queue, and when specifying to be sent Between, by the poll of role management unit 14, completion timing is sent.This asynchronous transmission process not throw in mail transmit queue The mail passed can be revoked, i.e., after by mail requests header and the step of be put into mail transmit queue, for postal The mail requests header specified in part transmit queue, if the current expectation not reached in the mail requests header sends postal The time of part, the mail requests header can be deleted in queue, so as to realize the corresponding mail of revocation.
Step S207:Persistence unit 13 is saved in persistent storage after being changed to the data format of mail entity In unit 24.Mail entity contains all the elements of request for sending E-mail information.After this step, request reception unit 11 is to visitor Family end API unit sends service response.By the persistent storage of persistent storage unit 24, when the failure of mail server 26 or When Mailing List member 16 breaks down, all without the mail for influenceing not deliver.It may now cause to delay to deliver, but not lose Lose data.It is favorably improved mail treatment reliability of service.
Step S208:Client end AP I unit sends service response to application system.So application system learns that mail takes Business is accepted.
Step S209:Role management unit 14 is polled to mail transmit queue.
Step S210:Role management unit 14 checks whether current time reaches the postal of the queue heads of mail transmit queue The expectation that part is sent in request header information sends the time of mail.If so, then enter step S211;Otherwise return after the delay S209, carry out poll next time.
Step S211:Role management unit 14 handles mail entity.In this step, role management unit 14 moves from queue Except head of the queue identifies, calling treats longization unit 13, and the mail entity of queue heads mail is read from persistent storage unit 24.
Step S212:Role management unit 14 parses mail entity to be sent, calls template parsing single by service interface Member.
Step S213:Template resolution unit 15 renders template.In this step, template resolution unit 15 according to email template and Request for sending E-mail information and the business datum of acquisition generation mail.This is the mode that a kind of dynamic renders template, is realized The separation of business datum and email template, such stencil design is independent from business development, realizes the multiplexing of template, and And it is easy to stencil design and the division of labor of other staff.
Step S214:Mail is sent to e-mail server 26 by Mailing List member 16.In this step, mail is sent out Send unit 16 to send SMTP requests to e-mail server 26, and wait the response of the latter, and sent out to role management unit 14 Send back to and hold.Mailing List member 16 can dispose it is multiple, it is extending transversely according to service deployment, the offer postal of high efficient and reliable is provided Part processing service.
Step S215:Role management unit 14 judges whether mail sends success according to the receipt received.If so, then call The result that mail is sent is saved in persistent storage unit 24 by persistence unit 13, i.e. step 216, and the result mainly includes Mail data and transmission time etc..If mail transmission is unsuccessful, into step S217.
Step S217:Role management unit 14 checks that mail sends whether the frequency of failure reaches default sending times, if It is then to send mail failure receipt, i.e. step 218 to client end AP I unit 21.Otherwise step S219 is entered.
Step S219:Change the transmission time of the mail in mail transmit queue, return to step S209, i.e., etc. it is to be retransmitted this Mail.
Technical scheme according to embodiments of the present invention, according to the request for sending E-mail information from operation system, to mail E-mail server is sent to by transmit queue, realizes and multiple operation systems is provided with unified mail service.In network Under the premise of available, the implementation can provide the mail requests processing service concentrated for each scattered business, dynamically render Email template, asynchronous progress mail transmission, ensure that efficient, reliable mail is sent, simplify exploitation and pipe that mail sends business Reason.And can be according to business scale, progress is extending transversely, ensures that system is capable of the offer mail treatment service of high efficient and reliable.
The general principle of the present invention is described above in association with specific embodiment, in apparatus and method of the present invention, it is clear that Each part or each step can be decomposed and/or reconfigured.These decompose and/or reconfigure should be regarded as the present invention etc. Efficacious prescriptions case.Also, perform above-mentioned series of processes the step of can order naturally following the instructions perform in chronological order, still And necessarily it need not perform sequentially in time.Some steps can perform parallel or independently of one another.
Above-mentioned embodiment, does not form limiting the scope of the invention.Those skilled in the art should be bright It is white, depending on design requirement and other factors, various modifications, combination, sub-portfolio and replacement can occur.It is any Modifications, equivalent substitutions and improvements made within the spirit and principles in the present invention etc., should be included in the scope of the present invention Within.

Claims (5)

  1. A kind of 1. method for handling mail, it is characterised in that including:
    Request for sending E-mail information is received, email template, posting address are specified in the request for sending E-mail information and it is expected Send the time of mail;
    According to the time generation mail requests header for it is expected to send mail and mail transmit queue is put into, and preserves institute State the content of request for sending E-mail information;For the mail requests header specified in mail transmit queue, if not arriving currently The time of mail is sent up to the expectation in the mail requests header, the mail requests header is deleted in queue, so as to real Now cancel corresponding mail;
    Mail transmit queue described in poll and current time reach it is described it is expected send mail time in the case of, according to The email template and the request for sending E-mail information and the business datum of acquisition generation mail;
    The mail is sent to e-mail server, for described in the e-mail server to posting address transmission Mail.
  2. 2. according to the method for claim 1, it is characterised in that the step of mail is sent to e-mail server Afterwards, in addition to:
    In the case where receiving and representing prompt message that mail sends failure, transmission time again of mail is set, and according to This sends the new mail requests head of time generation and is put into the mail transmit queue again.
  3. A kind of 3. system for handling mail, it is characterised in that including:
    Request reception unit, for receiving request for sending E-mail information, specified in the request for sending E-mail information email template, Posting address and the time for it is expected transmission mail;
    Queue processing unit, for generating mail requests header according to the time for it is expected transmission mail and being put into mail Transmit queue;For the mail requests header specified in mail transmit queue, if current do not reach mail requests head letter Expectation in breath sends the time of mail, and the mail requests header is deleted in queue, so as to realize the corresponding mail of revocation;
    Persistence unit, for the content of the request for sending E-mail information to be saved in into persistent storage device;
    Role management unit, for mail transmit queue described in poll and reach the expectation in current time and send mail In the case of time, template resolution unit is called;
    Template resolution unit, for according to the email template and the request for sending E-mail information and the business datum of acquisition Generate mail;
    Mailing List member, for the mail to be sent into e-mail server, so that the e-mail server is to institute State posting address and send the mail.
  4. 4. system according to claim 3, it is characterised in that
    The queue processing unit is multiple;
    The request reception unit is additionally operable to select a queue processing unit in a manner of load balancing, then by the mail Send solicited message and be transmitted to the queue processing unit.
  5. 5. the system according to claim 3 or 4, it is characterised in that
    The Mailing List member is additionally operable to the transmission object information that the e-mail server returns being transmitted to described appoint Business administrative unit;
    The role management unit is additionally operable to, in the case where the transmission object information represents that mail sends failure, set mail The transmission time again, and send according to this time again and generate new mail requests head and be put into the mail and send team Row.
CN201510078957.2A 2015-02-13 2015-02-13 Handle the method and system of mail Active CN104601454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510078957.2A CN104601454B (en) 2015-02-13 2015-02-13 Handle the method and system of mail

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510078957.2A CN104601454B (en) 2015-02-13 2015-02-13 Handle the method and system of mail

Publications (2)

Publication Number Publication Date
CN104601454A CN104601454A (en) 2015-05-06
CN104601454B true CN104601454B (en) 2018-04-10

Family

ID=53126974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510078957.2A Active CN104601454B (en) 2015-02-13 2015-02-13 Handle the method and system of mail

Country Status (1)

Country Link
CN (1) CN104601454B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106571995B (en) * 2015-10-13 2019-11-12 北京国双科技有限公司 E-mail sending method and device
CN106973002B (en) * 2016-01-13 2021-11-02 北京京东尚科信息技术有限公司 E-mail sending method and device
CN108259316B (en) * 2017-03-14 2021-04-09 平安科技(深圳)有限公司 E-mail processing method and device
CN109672605B (en) * 2018-09-26 2022-04-15 深圳壹账通智能科技有限公司 Mail distribution method, device, equipment and readable storage medium
CN109977379A (en) * 2018-12-21 2019-07-05 中国平安人寿保险股份有限公司 Mail generation method, device, electronic equipment and computer readable storage medium
CN111245707A (en) * 2020-01-08 2020-06-05 北京小米移动软件有限公司 Mail transmission method, device, electronic equipment and storage medium
CN113556276A (en) * 2020-04-23 2021-10-26 北京沃东天骏信息技术有限公司 Method and device for sending mail
CN114363284B (en) * 2021-12-23 2024-03-19 深圳市六度人和科技有限公司 Mail batch sending method, device and storage medium based on mobile terminal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101317408A (en) * 2005-09-29 2008-12-03 蒂蒙系统公司 Method and system for providing asynchronous communication through internet
CN103384219A (en) * 2013-07-18 2013-11-06 新浪网技术(中国)有限公司 E-mail sending method and system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6691156B1 (en) * 2000-03-10 2004-02-10 International Business Machines Corporation Method for restricting delivery of unsolicited E-mail
CN1151460C (en) * 2000-11-22 2004-05-26 英华达股份有限公司 Method for timing automatic transmission of electronic mail
CN1305168A (en) * 2000-12-28 2001-07-25 英业达集团(南京)电子技术有限公司 Method for automatic timing transmission of e-mails
CN1169075C (en) * 2001-04-29 2004-09-29 国家数字交换系统工程技术研究中心 Automatic e-mail treatment method and device
CN101442498A (en) * 2007-11-19 2009-05-27 上海新纳广告传媒有限公司 Method for self-timing transmission of e-mail
US8762385B2 (en) * 2011-01-28 2014-06-24 Oracle International Corporation Methods and systems for implementing email recipient templates

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101317408A (en) * 2005-09-29 2008-12-03 蒂蒙系统公司 Method and system for providing asynchronous communication through internet
CN103384219A (en) * 2013-07-18 2013-11-06 新浪网技术(中国)有限公司 E-mail sending method and system

Also Published As

Publication number Publication date
CN104601454A (en) 2015-05-06

Similar Documents

Publication Publication Date Title
CN104601454B (en) Handle the method and system of mail
US6976092B1 (en) System that using transport protocol objects located at agent location to generate session ID and to provide translation between different instant messaging protocols
CN101317474B (en) Message conversion equipment, system and conversion method
US7469301B2 (en) Server-based message protocol translation
US7444429B2 (en) System uses transport protocol objects locate at user agent location to provide translation between different instant messaging protocols
EP1962461B1 (en) Method for realizing group-sending message service, device and system for the same
US8447821B2 (en) System and method for configuring access to electronic mailboxes
EP1091536B1 (en) Methods and systems for conversion of data format
CN101159714B (en) Instant communication method and device
US8838702B2 (en) System and method for generating configurations used for accessing electronic mailboxes
CN101079849B (en) Method and system for sending offline messages in instant communication system
US8488448B2 (en) System and method for message sequencing in a broadband gateway
US7103676B2 (en) User-identifier translator and linking apparatus for XML-based services and corresponding method
EP2116038A1 (en) System and method for unified messaging service
WO2007007962A1 (en) Messenger notification system and method using synchronization server
WO2006043495A1 (en) E-mail transmission system
JP4519855B2 (en) Pull mode messaging service independent of transport
US7822864B2 (en) Communication apparatus, program product for adding communication mechanism to communication apparatus for providing improved usability and communication efficiency, and recording medium storing program product
JP2005322222A (en) Communication function adding method, program, storage medium and communication apparatus
WO2004074972A2 (en) Virtual mailbox
US20090080445A1 (en) System and method for message retry in a broadband gateway
CN101925021B (en) Method/system for processing messages and convergence service system
Goel et al. Message-oriented-middleware in a distributed environment
CN102904965A (en) Message reminding system and method
US8385195B2 (en) System and method for message processing in a broadband gateway

Legal Events

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