2010-03-28 52 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