What I need to do is send two emails. The emails are different in content, but get sent one right after the other. I would like to use a single SmtpClient to send both, since it doesn't make sense that I should need to create two objects. Here's is what I am currently doing.
Dim message As New Aspose.Network.Mail.MailMessage
message.From = "from email"
message.To.Add("to email")
message.Subject = "message 1"
message.HtmlBody = "
this is message 1
"Dim smtp As New Aspose.Network.Mail.SmtpClient("my mail server")
smtp.AuthenticationMethod = Aspose.Network.Mail.SmtpAuthentication.None
smtp.Send(message)
message = New Aspose.Network.Mail.MailMessage
message.From = "from email 2"
message.To.Add("to email 2")
message.Subject = "message 2"
message.HtmlBody = "
this is message 2
"smtp.Send(message)
The problem with the above code is that only the first email gets sent. I don't receive any error on the second message, it simply is not sent. If I add:
smtp.AuthenticationMethod = Aspose.Network.Mail.SmtpAuthentication.None
right before the second "smtp.Send(message)" line, then the 2nd message gets sent. This seems a little odd to me, since I already defined this property for my smtp object. I'm guessing that something happens internally to your SmtpClient class that resets something, preventing the same SmtpClient from being able to send more than one message. Please look into this and fix it. I'll use my work around temporarily.
Thanks!
Dan