2010-03-28 54 views

回答

4
using System.Net.Mail; 
... 

MailMessage message = new MailMessage(); 
message.From = new MailAddress("[email protected]"); 

message.To.Add(new MailAddress("[email protected]")); 
message.To.Add(new MailAddress("[email protected]")); 
message.To.Add(new MailAddress("[email protected]")); 

message.CC.Add(new MailAddress("[email protected]")); 
message.Subject = "This is my subject"; 
message.Body = "This is the content"; 

SmtpClient client = new SmtpClient(); 
client.Send(message); 
在web.config

<system.net> 
<mailSettings> 
    <smtp from="[email protected]"> 
    <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" /> 
    </smtp> 
</mailSettings> 

感谢Scott

+0

海thanx您的回复......可以请您解释一下什么是主机的 “smtpserver1” 用户名=”用户名“密码=”秘密“....在哪里我将得到所有这些......? – Sri 2010-03-29 04:31:53

+0

谷歌它,你可以设置你自己的,使用你的ISP的,使用谷歌/雅虎邮件smtp服务器。 – 2010-03-29 06:46:24

+0

好的thanx密码和用户名是......? – Sri 2010-03-29 07:43:05