Operation for sending emails in Windows Phone development

Source: Internet
Author: User

The code is really too simple, as long as you are willing to really just Ctrl + C thing. It is convenient for you to write less code and directly upload the code.

Using system; using system. net; using system. windows; using system. windows. controls; using system. windows. documents; using system. windows. ink; using system. windows. input; using system. windows. media; using system. windows. media. animation; using system. windows. shapes; using Microsoft. phone. tasks; namespace microblogforwp7.classes. util {// <summary> /// send email /// </Summary> public class sendemail {/// <summar Y> // send email /// </Summary> /// <Param name = "emailaddrss"> email address </param> /// <Param name = "emailcontent "> email content </param> /// <Param name =" emailsubject "> email title </param> /// <Param name =" fromemail "> from email address </param> // <returns> </returns> Public bool sendemailfrom (string emailaddrss, string fromemail, string emailsubject, string emailcontent) {emailcomposetask task = new emailcomposetask (); If (checkemail (emailad Drss) & checkemail (fromemail) & fromemail! = "" & Emailcontent! = "") {Task. to = emailaddrss; // mail address task. cc = fromemail; // The email comes from the address task. subject = emailsubject; // mail title task. body = emailcontent; // right-click the content task. show (); Return true;} else {return false ;}} /// <summary> /// verify the email format /// </Summary> /// <Param name = "emailaddress"> email address </param> /// <returns> </returns> Public bool checkemail (string emailaddress) {// verify the e-mail Format String regexemail = "^ \ W + ([-+.] \ W +) * @ \ W + ([-.] \ W + )*\\. \ W + ([-.] \ W +) * $ "; system. text. regularexpressions. regexoptions Options = (system. text. regularexpressions. regexoptions. ignorepatternwhitespace | system. text. regularexpressions. regexoptions. multiline) | system. text. regularexpressions. regexoptions. ignorecase); system. text. regularexpressions. regEx regemail = new system. text. regularexpressions. regEx (regexemail, options); string email = emailaddress; If (regemail. ismatch (email) // enter the regular expression {return true;} else {return false ;}}} in the email field ;}}}}
Related Article

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.