sHi folk,
I've been storing SQL connection strings in web.conf which is fine but now I need to store SMTP credentials somewhere protected. web.conf seems like the likeliest place since its protected but how can they be stored?
I've added the details to my web.conf but amnot sure how to reference them
<system.net>
<mailSettings>
<smtp>
<network
host ="server"
userName ="username"
password ="password"
defaultCredentials =" false"
port =" 25"
/>
</smtp>
</mailSettings>
</system.net>
Sending the mail:
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("[email protected]")
mail.To.Add(ToAddress)
'set the content
mail.Subject = "User Request Submitted via Client Portal"
mail.Body = "text in here"
mail.IsBodyHtml = True
' authenticatin
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("username", "-password-")
'send the message
Dim smtp As New SmtpClient("servername")
smtp.UseDefaultCredentials = False
smtp.Credentials = basicAuthenticationInfo
smtp.Send(mail)
-- Jonesy