Using (SmtpClient SmtpClient=new SmtpClient (" smtp.qq.com "))
{
//fill E-mail information
//mailmessage. To. The Add (" 947806342 @qq.com ");
Mailmessage. To. The Add (diz);//you can have multiple
Mailmessage. Body="hello" + Name + ", your password is set to the initial password is 123456, after landing can be redone, ";
Mailmessage. From=new MailAddress (" 2051845764 @qq.com ");
Mailmessage. Subject="silver luxury KTV";
Smtpclient. Credentials=new System.Net.NetworkCredential (" 2051845764 @qq.com ", "qektdjzvouoqbfed");
Smtpclient. Send (mailmessage);//send
CodePudding user response:
SendQQMail (" smtp.qq.com ", "the sender @ qq.com", "authorization code", "the recipient @ qq.com", "QQ email mailbox server", "use asp.net to send E-mail, use QQ smtp.qq.com server, test success");Public void SendQQMail (string strSmtpServer, string strFrom, string strFromPass, string strto,
String strSubject, string strBody)
{
SmtpClient SmtpClient=new SmtpClient ();
SmtpClient. EnableSsl=true;
SmtpClient. UseDefaultCredentials=false;//set the first
SmtpClient. DeliveryMethod=SmtpDeliveryMethod.Net work; Specified email//
SmtpClient. Host=strSmtpServer;//specify the SMTP server
SmtpClient. Credentials=new System.Net.NetworkCredential (strFrom strFromPass);//
user name and password
//email Settings
MailMessage MailMessage=new MailMessage (strFrom strto);//send and recipient
MailMessage. Subject=strSubject;//theme
MailMessage. Body=strBody;//content
MailMessage. BodyEncoding=Encoding. UTF8;//text encoding
MailMessage. IsBodyHtml=true;//set to HTML
MailMessage. Priority=MailPriority. Low;//priority
SmtpClient. Send (mailMessage);
}
CodePudding user response:
Enter your QQ email set up inside to see open no Smtp functionCodePudding user response:
White list to see added to the mail,CodePudding user response:
https://blog.csdn.net/starfd/article/details/80706227This is sure to send success
CodePudding user response:
Below can certainly has been in use at present, you give it a try, if not, contact space, check whether your space support sending (such as the default does not support the western digital space, don't send spam to be signed pledge to open to you, when testing for a long time also wonder the along while)MailAddress receiver=new MailAddress (" the recipient mailbox ", "name of the recipient");
MailAddress sender=new MailAddress (" the sender email address ", "the sender name");
MailMessage message=new MailMessage ();
Message. The From=sender;//the sender
The message. To. Add (receiver);//the recipient
//message. CC. The Add (sender);//cc
Message. The Subject="email";//title
StringBuilder sb=new StringBuilder();
StringWriter sw=new StringWriter (sb);
HtmlTextWriter HTW=new HtmlTextWriter (sw);
Mbody. RenderControl (HTW);
String divstr=sb. ToString ();
Message. The Body=divstr;//content
Message. IsBodyHtml=true;//support content to HTML
SmtpClient client=new SmtpClient ();
Client. The Host="smtp.exmail.qq.com";
//client. The Port=465;
Client. EnableSsl=true;//whether to enable SSL
Client. The Timeout=80000;//timeout
Client. DeliveryMethod=SmtpDeliveryMethod.Net work;
Client. UseDefaultCredentials=false;
Client. The Credentials=new NetworkCredential (" the sender email address ", "passwords");
Client. The Send (message);