Email Web Client

Source: Internet
Author: User

Some time ago, it was a headache to be busy with the mail client.

There are not many related information on the Internet. It is mainly about sending emails and is mainly used to reply to messages. These functions are mainly used on the enterprise site, and are not enough for web clients.

Webmail includes: inbox, mail box, draft box, sent mail, spam mail, spam mail processing, signature management, inbox management, folder management, and user name information management.

The inbox is the most time-consuming one. Restrictions on web programs, network requirements, and performance requirements are relatively high.

The most important aspects of mail are: ability to receive, send, do not lose mail, can see.

What you need to upgrade: Fast receiving, fast sending, high stability, and timed sending and receiving.

 

The third-party component used here is jmail. Jmail is used in many places. This component has a free version, which may be one of the reasons for its popularity.

When sending an email, it has the following advantages: You can set the priority of the email, support HTML mail, add images to the email, support multiple recipients, and CC; supports SMTP servers for SMTP sending authentication;

Here is a message sending code on the Internet:

/*************************************** ***/

Public bool Sendmail ()
{
Try
{
Jmail. messageclass mymail = new jmail. messageclass ();
Mymail. charset = "gb2312"; // use character set for mail
Mymail. From = model. From; // mail address of the sender
Mymail. fromname = model. fromname; // mail sender name
Mymail. addrecipient (model. To, model. toname, ""); // Add the email recipient name and email address

Mymail. Subject = model. Subject; // mail subject
Mymail. Body = model. Body; // mail content
// Determine whether an attachment exists
If (model. filename! = "")
{
Mymail. addattachment (model. filename, false, model. filetype); // Add email attachments
}
Mymail. Priority = model. Priority; // email urgency
Mymail. mailserverusername = model. mailserverusername; // username used to log on to the email server
Mymail. mailserverpassword = model. mailserverpassword; // password used to log on to the email server
Return mymail. Send (model. maildomain, false); // mail server address (for example, smtp.163.com)
}
Catch (exception ex)
{
Throw new exception (This + ". Sendmail ():" + ex. tostring ());
}
}

/*************************************** ***/

 

Then the mail is received:

There is a receiving time issue in receiving emails. This tangle has been around for a long time.

When there are 10 emails in the email server, 10 emails are received. Jmail is fast. How can I receive a new email in a few days?

Many people will say that it is OK to determine whether the email is not received. If it is received, it will be OK. This is the case, but how can we determine whether there are unreceived emails?

When saving the email to the database, there is a unique ID-mailid (which algorithm is not clear ). Read the mailid on the mail server and determine whether the email exists one by one. If yes, obtain the email information.

If the number of emails is less than 200, this method can still be used without affecting the speed.

 

So what about 20000 servers?

IMAP technology can be implemented to only receive emails, such as header or size.

 

 

To be continued ......

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.