Hi Peeps,
I am having a problem sending emails from my website. Intially I was putting the settings in the web.config file and then changed to code but it is still looking in the web.config file; why? Here is my code for sending an email:-
Any ideas please,Code:Dim member As MembershipUser = Membership.GetUser(User.Identity.Name) Dim sEmailAddress As String = member.Email.ToString Dim mmEMail As New MailMessage(rppGlobals.FromEmailAddress, sEmailAddress) Dim smtp As New SmtpClient Dim sBody As String Dim Attach As New System.Net.Mail.Attachment(Server.MapPath("") & "\CSVFiles\" & sFilename) Dim basicAuthenticationInfo As New System.Net.NetworkCredential("Username", "Password", "Domain") mmEMail.Subject = sFilename mmEMail.Attachments.Add(Attach) sBody = "" mmEMail.Body = sBody smtp.Host = "host.address.0.0" smtp.Port = 0 smtp.UseDefaultCredentials = False smtp.Credentials = basicAuthenticationInfo smtp.Send(mmEMail) mmEMail.Dispose()
Jiggy!




Reply With Quote