C#邮件发送

1.首页要设置你的邮件账号开启了smtp Server

2.简单的3.5都显示过期的发送邮件代码

 

代码
        MailMessage message  =   new  MailMessage();
        message.From 
=   " [email protected] " ;
        message.BodyFormat 
=  MailFormat.Html;
        message.Fields.Add(
" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate " " 1 " );
        message.Fields.Add(
" http://schemas.microsoft.com/cdo/configuration/sendusername " " [email protected] " );
        message.Fields.Add(
" http://schemas.microsoft.com/cdo/configuration/sendpassword " " pengtaoo " );
        SmtpMail.SmtpServer 
=   " smtp.qq.com " ;
        message.To 
=   " [email protected] " ;
        message.Subject 
=   " test " ;
        message.Body 
=   " teset " ;
        message.BodyEncoding 
=  Encoding.GetEncoding( " gb2312 " );
        SmtpMail.Send(message);

 

 

你可能感兴趣的:(邮件发送)