LittlBUGer
Programmer
Hello all. I'm having some ASP.NET 2.0 emailing issues that I can't seem to figure out. When I first began programming a new website, which started using ASP.NET user authentication controls and registration to a MS SQL DB, all was fine. Meaning, with the details I put in for the web.config SMTP section, when a new user registered it would properly email them their details, etc. Now a month or so later, after I haven't changed anything in the web.config file, the emails don't work anymore. I even tested by making a simple "Contact Us" page and dynamically made it send an email, and it says it worked, but there's no email. I'm pretty positive the mail account that I'm using on our server is good, as I can login and it gets and sends email, so I'm kind of stuck on what's going on. Any suggestions? My web.config code for that section is below:
And the code for the ContactUs page is below:
Thanks.
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein
Code:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="blah@blah.com">
<network port="25" host="blahmail" password="blahpass" userName="blahuser" />
</smtp>
</mailSettings>
</system.net>
And the code for the ContactUs page is below:
Code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("MBN <blah@blah.com>"))
If cbSendCopy.Checked = True Then
Mailmsg.Bcc.Add(New System.Net.Mail.MailAddress(tbName.Text & " <" & tbEmail.Text & ">"))
End If
Mailmsg.From = New System.Net.Mail.MailAddress(tbName.Text & " <" & tbEmail.Text & ">")
Mailmsg.Subject = tbSubject.Text
Try
Mailmsg.Body = tbMessage.Text
obj.Send(Mailmsg)
lblMessage.ForeColor = Drawing.Color.Green
lblMessage.Text = "Message sent successfully!"
tbName.Text = ""
tbEmail.Text = ""
tbSubject.Text = ""
tbMessage.Text = ""
cbSendCopy.Checked = False
Catch ex As Exception
lblMessage.ForeColor = Drawing.Color.Red
lblMessage.Text = "Error! Email Send Failed! - " & ex.Message
End Try
End Sub
Thanks.
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein