Configuring the App Config to work with smtp
Posted on 2007-04-10
I have the following code snippet that is working to send an email via smtp. I would like to use an appconfig file to store the host,and to and from email addresses.....I cant seem to figure out how to setup the app config file so that it will work...here is what I ha ve so f ar.
here is my snippet from my config file...
and here is the code without referencing the appconfig
Dim mMailMessage As New MailMessage()
'sender e-mail address.
mMailMessage.From = New MailAddress("email@example.com")
'recipient e-mail address.
' Set the subject of the mail message
mMailMessage.Subject = "ALERT"
' Set the body of the mail message
mMailMessage.Body = "<HTML><BODY><B>ALERT! The system did not process the ADS_Blend Job</B></BODY></HTML>"
' Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = True
' Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.Normal
' Instantiate a new instance of SmtpClient
Dim mSmtpClient As New SmtpClient()
mSmtpClient.Host = "127.0.0.1"
' Send the mail message