2010-07-17 7 views
0

이메일을 보내려면 IIS에서 관리되는 SMTP 서버 구성이 있어야합니다. 내 PC IP 배달을 추가했습니다.> 고급 스마트 호스트에서 내 도메인 이름을 mail.elarabygroup.com으로 추가합니다.으로 이메일 보내기 SMTP

그리고이 코드 추가 :

<script runat="server"> 
     protected void SendEmail(object sender, EventArgs e) 
     { 
      SmtpClient smtpClient = new SmtpClient(); 
      MailMessage message = new MailMessage(); 
      try 
      { 
       // Prepare two email addresses 
       MailAddress fromAddress = new MailAddress(
       "[email protected]", "From Kareem Test"); 
       MailAddress toAddress = new MailAddress(
       "[email protected]", "From Kareem Test"); 
       // Prepare the mail message 

       message.From = fromAddress; 
       message.To.Add(toAddress); 
       message.Subject = "Testing!"; 
       message.Body = "This is the body of a sample message"; 
       // Set server details 
       smtpClient.Host = "localhost"; 
       // Uncomment for SMTP servers that require authentication 
       //smtpClient.Credentials = new System.Net.NetworkCredential(
       // "user", "password"); 
       // Send the email 
       smtpClient.Send(message); 
       // Inform the user 
       statusLabel.Text = "Email sent."; 
      } 
      catch (Exception ex) 
      { 
       // Display error message 
       statusLabel.Text = "Coudn't send the message!"; 
      } 
     } 
    </script> 

을하지만 오류가 발생합니다

사서함을 사용할 수 없습니다. 서버 응답 : 5.7.1 [email protected]에 릴레이 할 수 없습니다.

답변

0

전자 메일 서버의 관리자에게 문의하십시오. 기본적으로 릴레이를 허용하지 않는 경우가 있으므로 서버에 로그인/비밀번호 조합을 제공해야 할 수 있습니다 (스 니펫의 NetworkCredentials 참조).

릴레이가 mail.elarabygroup.com 일 수 있음을 나타냅니다. --- 의도적으로 "e"입니다. 이 예에서 사용하는 도메인과 다릅니다. 그것이 당신이 중계 할 수없는 이유 일 수 있습니다.

+0

"e"나는 그것을 놓쳤다. 그러나 그것은 이유가 없었다. 또한 [email protected] 나는 그것을 보내고 reciev 이메일을 통해 그것을 사용한다. – Myworld

+0

나는 VM웨어에서 일한다고 말할 수밖에 없다. – Myworld

+0

[http://meta.stackexchange.com/questions/46035/should-i-remove-tags-that-dont-contribute-to-categorizing- the-question/46037 # 46037) [태그] (http://meta.stackexchange.com/questions/43879/anti-tags-valid-use-or-not) [프로그래밍되지 않는 관련.] (http : /meta.stackexchange.com/questions/10216/can-we-disallow-the-use-of-belongs-on-xxxxxxx-and-not-programming-related-tag/10222#10222) (또한 3 편지, 그래서 [댓글 회신] (http://meta.stackexchange.com/questions/43019/how-do-comment-replies-work) 직장, 도움이 될 것입니다. :) –

관련 문제