Get the Email Address Book (contacts/Email Address Book)

Source: Internet
Author: User
Download the component (excluding the original file): http://download.csdn.net/source/496787use the following example to create an emailcontactsclass using system; using system. collections. generic; using system. net; using system. text; using opencontactsnet; /// <summary> /// method for obtaining the Email Contact /// </Summary> public class emailcontacts {/// <summary> /// obtain the Email Contact List/ /// </Summary> /// <Param name = "username"> email address </param> /// <Param name = "password"> password </param>/ // <returns> </retu RNS> Public mailcontactlist getcontacts (string username, string password) {If (username. Split ('@'). length! = 2) return NULL; mailcontactlist list = NULL; networkcredential credential = new networkcredential (username, password); Switch (username. split ('@') [1]. tolower () {Case "gmail.com": gmailextract Gmail = new gmailextract (); Gmail. extract (credential, out list); break; Case "Yahoo.com": yahooextract Yahoo = new yahooextract (); Yahoo. extract (credential, out list); break; Case "live.com": Case "hotmail.com": liveextract live = new liveextract (); live. extract (credential, out list); break; default: break;} return list ;}}
2. Create a webform: getcontacts. aspxgetcontacts. aspx. csusing opencontactsnet; void page_load (Object sender, eventargs ARGs) {emailcontacts contacts = new emailcontacts (); mailcontactlist mails = contacts. getcontacts ("username@service.com", "password"); foreach (mailcontact mail in mails) {response. write ("name:" + mail. name); response. write ("Email:" + mail. email );}}

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.