Last post Feb 12, 2008 03:55 PM by amensi
Feb 12, 2008 01:45 PM|Varnell|LINK
I need send e-mail via an MS Exchange server. When ever someone submits a request through the website, I want to fire off an e-mail back to the submitter saying "thank you for submitting" and to an admin saying "something was submitted". I can do that with SMTP
and the .NET System.Net.Mail but it doesn't work through our MS exchange server? Any idea's on how this is done?
Feb 12, 2008 03:55 PM|amensi|LINK
First you need to add this in your web.config:
<smtp from="Tesnt Online">
<network host="mail.autobots.com" port="25" defaultCredentials="true" />
Then the Vb code to send the email would be:
Option Strict On
Partial Class _Default
Public lang As String = Nothing
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim smtp As New SmtpClient
Dim ToAddress As String
Dim status As String = Nothing
ToAddress = "email@example.com"
Dim msg As New MailMessage(txtEmail.Text, ToAddress)
Dim i As Integer
Dim strTypeAssurance As String = Nothing
msg.Subject = "Soumission en ligne: " + lblId.Text + " - " + lblTimeStamp.Text
msg.Body = "Whatever text you want"
msg.IsBodyHtml = False
msg.Priority = MailPriority.High
lblConfirmMsg.text = "Message sent"
Catch ex As SmtpException
lblConfirmMsg.text = "Message not sent"