Using message As New MailMessage(safeSender, New MailAddress("accounts@grasshoppersoccer.com.au", "Accounts")) With {.IsBodyHtml = True, .Subject = "New invoice"} message.Body = String.Format(Globalization.CultureInfo.CurrentCulture, "A new invoice from company is avaiable at {0}", url.ToString) Using client As New SmtpClient() client.Port = 26 client.Send(message) End Using End Using
I have the above code twice in a class with little only differeing by email, subject and body, yet code analysis tells me that i need to dispose of mailmessage in only one of them.
It woulde seem that i am disposing of mailmessage, am i missing somthing?
Thanks