SMTP mail problem .NET 2005
Hello,
I have the following code for sending SMTP mail.
My problem is that the mail is sent only when I close the application.
Even if I send 3 times. It will send 3 copies when I close the application.
Any Ideas?
Private Sub SendSMTPMail()
Dim SMTPMail as New System.Net.Mail.SmtpClient("emea.ibm.com")
Dim email As New System.Net.Mail.MailMessage
Try
email.To.Add("user@il.ibm.com")
email.From = New System.Net.Mail.MailAddress("user@il.ibm.com")
email.Body = "text text text"
email.Subject = "new mail"
SMTPMail.Send(email)
Catch
End Try
End Sub
Thanks,
Itay
[767 byte] By [
itayc1] at [2007-11-20 8:28:55]

# 1 Re: SMTP mail problem .NET 2005
Hello,
I have the following code for sending SMTP mail.
My problem is that the mail is sent only when I close the application.
Even if I send 3 times. It will send 3 copies when I close the application.
Any Ideas?
Private Sub SendSMTPMail()
Dim SMTPMail as New System.Net.Mail.SmtpClient("emea.ibm.com")
Dim email As New System.Net.Mail.MailMessage
Try
email.To.Add("user@il.ibm.com")
email.From = New System.Net.Mail.MailAddress("user@il.ibm.com")
email.Body = "text text text"
email.Subject = "new mail"
SMTPMail.Send(email)
Catch
End Try
email = Nothing
SMTPMail = Nothing
End Sub
This should help ...
Gremmy...