A relay server connected to a mail management server that saves mails for saving and, in response to a request from a communication terminal, delivers a mail for the communication terminal, to a mail transfer server, and to the communication terminal, the relay server comprising a processor and a non-transitory storage unit storing a mail relay program, wherein the mail relay program, when executed by the processor, causes the relay server:
- to receive a mail from the mail transfer server;
- after receiving the mail, to judge whether a compression effect of the received mail exceeds a predetermined value, or equal to or lower than the predetermined value;
- when it is judged that the compression effect of the received mail exceeds the predetermined value, to compress the received mail including a mail body and a mail header to create a body of a mail for saving, to create a header of the mail for saving including compression information on the compression and information included in the mail header of the received mail, and to transmit to the mail management server the mail for saving including the header of the mail for saving and the body of the mail for saving, to make the management server save the mail for saving;
- and
- when it is judged that the compression effect is equal to or lower than the predetermined value, to transmit the received mail to the mail management server, so as to make the management server save the received mail without compressing the received mail as a mail for saving,
- wherein the mail relay program, when executed by the processor, further causes the relay server, when receiving a request relating to a mail saved in the mail management server from the communication terminal:
- to analyze the request and converts the request according to an analysis result of the request so as to be able to properly respond to the request;
- to transmit the converted request to the mail management server;
- to receive from the mail management server as a response to the converted request, information relating to the mail for the communication terminal;
- to create, based on the analysis result and the received information relating to the mail, the response to the received request from the communication terminal;
- and
- to transmit the created response to the communication terminal,
- wherein the mail relay program, when executed by the processor, further causes the relay server, if the received information relating to the mail relates to the mail for saving, and the analysis result indicates that the request is a mail fetch request, a request to fetch a part of mail data, or a request to analyze mail data:
- to restore the received mail before being compressed, by decompressing the body of the mail for saving saved in the mail management server;
- and
- based on the restored mail and the analysis result, to create a response to the received request from the communication terminal, and
- wherein the mail relay program, when executed by the processor, further causes the relay server:
- to add header items which are included in the header of the mail for saving received as a response and which are added by the mail management server, to a mail header of the restored mail;
- to perform, if the request is a mail header fetch command, extracting a mail header to which the items are added, or if the request is a body structure fetch command, analyzing the mail body structure of the mail;
- and
- to create the response.