MailMessage mailObj=new MailMessage ();
MailObj. From=new MailAddress (Common. AppConfig. GetEmailUserName ());//the sender email address [email protected]
MailObj. To. The Add (Common. AppConfig. GetPutEmailUserName ());//the recipient email address
MailObj. Subject="test";//theme
MailObj. Body="test";//the body of the
MailObj. IsBodyHtml=true;
SmtpClient client=new SmtpClient (Common. AppConfig. GetEmailHost ());
Client. The Port=Common. AppConfig. GetEmailHostPort ();
Client. UseDefaultCredentials=true;
Client. EnableSsl=true;
Client. UseDefaultCredentials=true;
Client. Credentials=new NetworkCredential (Common. AppConfig. GetEmailUserName (), Common, AppConfig. GetEmailPassword ());//send the login name and password
Client. DeliveryMethod=System.Net.Mail.SmtpDeliveryMethod.Network;
Client. EnableSsl=true;
Try
{
Client. The Send (mailObj);
}
The catch (Exception)
{
}
CodePudding user response:
Are there any big,,CodePudding user response:
Several of SMTP server port (25465) try, if there is the SSL encryption to sendCodePudding user response:
https://blog.csdn.net/hanjun0612/article/details/54288854