Sending Email via exchange Server

  • Thread starter Thread starter Carlos
  • Start date Start date
C

Carlos

Does anyone know how to send a email from VB.net vie the exchange and the
outlook client setup in the machine where the application is going to run. I
tried the web thing but it did not work, the mail need to go vie exchannge.

Thanks
 
This is the Procedure I use and it work fine. Just make sure you put the
Imports statement at the top of your class/module

HTH,
Jim

Imports System.Web.Mail

Private Sub SendMailMessage(ByVal MailTo As String, ByVal Subject As String,
ByVal HTMLMessage As String)
Dim MailMessage As Web.Mail.MailMessage = New Web.Mail.MailMessage

With MailMessage
.From = "(e-mail address removed)"
.To = MailTo
.Subject = Subject
.BodyFormat = MailFormat.Html
.Body = HTMLMessage
End With

Web.Mail.SmtpMail.SmtpServer = "ExchangeServerName"
Web.Mail.SmtpMail.Send(MailMessage)
End Sub
 
Back
Top