Sending Email via exchange Server

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
 
J

J. Clay

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top