NETFrame2.0下的<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.126.com" userName="[email protected]" port="25" password="**********" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net><system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.126.com" userName="[email protected]" password="1234567" port="25" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
为什么我看到网上的资料说的都是<network host="mail.126.com" userName="[email protected]" password="1234567" port="25" >
但实际上是<network host="smtp.126.com" userName="[email protected]" password="1234567" port="25" > 这个密码为什么必须要写明呢, 但是资料上却都是***的,
高人指点下啊-----
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.126.com" userName="[email protected]" port="25" password="**********" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net><system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.126.com" userName="[email protected]" password="1234567" port="25" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
为什么我看到网上的资料说的都是<network host="mail.126.com" userName="[email protected]" password="1234567" port="25" >
但实际上是<network host="smtp.126.com" userName="[email protected]" password="1234567" port="25" > 这个密码为什么必须要写明呢, 但是资料上却都是***的,
高人指点下啊-----
{
try
{
MailMessage msg = new MailMessage();
//发送到
msg.To.Add(toaddr);
msg.From = new MailAddress(username, titel, System.Text.Encoding.UTF8);
//标题
msg.Subject = titel;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
//内容
msg.Body = body;
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = true;
//优先级
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(username, password);
client.Port = 587;
client.Host = server;
client.EnableSsl = true;
client.Send(msg);
}
catch (Exception ex)
{
throw ex;
}
}