2013-09-22 39 views
-2

我想發送郵件到我的web site.I註冊用戶有一個郵件服務器,它的名字是[email protected]將郵件發送到其他郵件,我的代碼如下如何從我的郵件服務器

protected void btnSave_Click(object sender, EventArgs e) 
{ 
    SmtpClient SmtpServer = new SmtpClient("[email protected]") 
    MailMessage mailim = new MailMessage(); 
    mailim.From = new MailAddress("[email protected]"); 
    mailim.To.Add("registered user's mail"); 
    mailim.Subject = "Activation code"; 
    mailim.IsBodyHtml = true; 
    mailim.Body = "<a href=\"http://www.bisorumvar.net/Uyelik_Onayla.aspx?mail=" + mail + "\">Please click this link to activate your registiration</a>"; 
    SmtpServer.Port = 587; 
    SmtpServer.UseDefaultCredentials = true; 
    SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "xxx"); 
    SmtpServer.EnableSsl = false; 
    SmtpServer.Send(mailim); 
} 

當我點擊按鈕,它不顯示任何錯誤,但它不將郵件發送到用戶的郵件ADRESS那麼,有沒有什麼錯誤人的幫助,請

+2

您應該更改密碼,_right now_。 – SLaks

+0

您的激活郵件不會添加任何安全性;攻擊者可以輕易地僞造該鏈接。 – SLaks

+1

'muratakarsu @ bisorumvar.net'不是SMTP服務器。 – SLaks

回答

3

在你寫的代碼:

SmtpClient SmtpServer = new SmtpClient("[email protected]") 

[email protected]不是服務器。這是一個電子郵件地址。

根據與nslookup你的域的郵件服務器如下:

  • antispam1.ihs.com.tr 94.138.192.240
  • antispam2.ihs.com.tr 94.138.192.241

下面是如何使用nslookup一個例子:

enter image description here

所以正確的代碼是:

SmtpClient SmtpServer = new SmtpClient("antispam1.ihs.com.tr") 
相關問題