2011-02-01 6 views

답변

12

SmtpClient class within the System.Net.Mail namespace

예제.

'create the mail message 
Dim mail As New MailMessage() 

'set the addresses 
mail.From = New MailAddress("[email protected]") 
mail.[To].Add("[email protected]") 

'set the content 
mail.Subject = "This is an email" 
mail.Body = "this is a sample body" 

'set the server 
Dim smtp As New SmtpClient("localhost") 

'send the message 
Try 
    smtp.Send(mail) 
    Response.Write("Your Email has been sent sucessfully - Thank You") 
Catch exc As Exception 
    Response.Write("Send failure: " & exc.ToString()) 
End Try 
+0

코드는 Microsoft Exchange 서버에서 실행됩니다. 다르게해야합니까? – Beginner

+0

교환 서버 설정 전문가가 아니지만 위의 Exchange 서버를 통해 메일을 보내는 응용 프로그램이 많습니다. 너 obv. 교환 서버 이름으로 "localhost"를 변경해야합니다. –

2

System.Net.Mail 네임 스페이스를 사용하여 검색하여 도움이되는지 확인할 수 있습니다. 나는 C#을 사용한다. 그러나 그것이 비슷하다고 상상해 본 다음 클라이언트를 만든 다음 메시지를 설정하고 메시지의 매개 변수를 설정 한 다음 client.Send()이 메시지를 보냅니다.

관련 문제