I have a problem with sending an email from my web app. It seems to send two copies of the mail and I am not sure why.
I am using:
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
SendMail("Senders Email Address", "Body")
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mailServerName As String = "smtp.mail.yahoo.co.uk"
Dim message As MailMessage = New MailMessage(from, "Email Address", "Subject", body)
Dim mailClient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub
What I cant seem to understand is why would SendMail get called twice when the Finish Button on the ASP Wizard is only pressed once?