Example:
Copy Code code as follows:
163.com of the mailbox in the early application is supported, the subsequent application is not supported.
21cn.com seems to have given up SMTP support now, and may only be paid by the user.
Qq.com's mailbox needs to be set in the user account.
I took a sina.com mailbox to test, also need in the backstage inside
Before you can send it. The detailed code is as follows:
Copy Code code as follows:
MailAddress from = new
Preparing to migrate some projects to ASP.net core start with the Encapsulation Class library and find the SMTP-related class library in ASP.net Core 1.0 when you encounter the mail delivery class, so a search on the internet found Mailkit
Good things must try, not to mention open source, the following is the code to implement SMTP mail delivery:
Using MAILKIT.NET.SMTP;
Using Mailkit.security;
Using Mimekit;
Using System.Threading.Tasks; Namespace ConsoleApp1 {public class Mailhelper {pub
Asp.net| issue in the new release of ASP.net 2.0, Microsoft no longer recommends using the System.Web.Mail namespace instead of the new System.Net.Mail namespace. Many new features have been introduced into the new library, but there are some minor errors in how the message is sent.
first, send mail
Before we discuss these small errors in detail, let's take a look at a sample code (we assume you've added a "using System.Net.Mail" to the file):
MailMessage msg = new MailMessa
. Net sends an email,. net
For. NET, it is very easy to send emails from 2.0. Next, I will give an example of sending an email in C # group. I have made some detailed annotations and hope to help some friends who need it.
// Introduce the namespaceUsing System. Net;Using System. Net. Mail;
SmtpClient smtp = new SmtpClient (); // instantiate a SmtpClientSmtp. DeliveryMethod = SmtpDeliveryMethod. Network; //
Send email in jsp1. We can send mail via any JSP Engine (such as JSWDK) that supports sun.net. smtp packages in sun specifications.(Warning: using the built-in internal Sun specification package will affect the portability of your jsp program .)The following scriptlet uses the SmtpClient class to send emails to jsp files.2. JavaMail is the official Java mail API. For details, refer to http://java.sun.com/products/javamail /. Although this API is riche
Change the password for email verification, retrieve the password through email, and change the password to retrieve the password
Use email verification to change the password. Here I use 163 free mail for testing
Front-end code
1
Background code
1 protected void btn (object sender, EventArgs e) 2 {3 string mail = Context. request ["Mail"]; 4 MailMessage message = new MailMessage (); 5 message. from = new MailAddress ("######", "#####"); // The sender address 6 message. to. add (mail); //
Public static void SendEmail (){
System. Net. Mail. SmtpClient client = new System. Net. Mail. SmtpClient ();// Use QQ's email address to send the test. If it is another email address, set it according to POP3/IMAP/SMTP in another email address.
Client. Host = "smtp.qq.com ";Client. usedefacrecredentials = false;Client. Credentials = new System. Net. NetworkCredential ("6 your email www.2cto.com", "*** pass
@ Try {System. Net. Mail. MailAddress from = new System. Net. Mail. MailAddress ("www.2cto.com", "ethan"); // enter the email address and display name.
System. Net. Mail. MailAddress to = new System. Net. Mail. MailAddress (www.2cto.com, "jimmy"); // enter the email recipient address and name.// Set the Sending address and Receiving address. The Receiving address can be multipleSystem. Net. Mail. MailMessage mail = new System. Net. Mail. MailMessage ();Mail. From = from;Mail. To. Add ();Mail. Su
Prepared by Zhu Xianzhong
In the newly released ASP. NET 2.0 version, Microsoft no longer recommends using the system. Web. Mail namespace instead of the new system. net. Mail namespace. Many new features are introduced in this new database, but some minor errors are also introduced in the mail sending method.
1. send an email
Before discussing these small errors in detail, let's take a look at an example.Code(Assume that you have added "using system. net. Mail" to the file "):
Mailmessa
For. net, it is very easy to send emails from 2.0. Next, I will give an example of sending an email in C # group. I have made some detailed annotations and hope to help some friends who need it.
// Introduce the namespaceUsing system. net;Using system. net. mail;
Smtpclient SMTP = new smtpclient (); // instantiate a smtpclientSMTP. deliverymethod = smtpdeliverymethod. Network; // set the SMTP outbound metho
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.