I'm somewhat new to VB.Net but I've programmed ASP.Net and VB6 before. Anyway, I'm trying to send a bunch of emails from a listbox and I get an error. Here's the exception message: "Could not access 'CDO.Message' object."
I don't know what could be causing it. If someone could shed some light I'd appreciate it. Here's my code:
Dim MailMsg As New System.Web.Mail.MailMessage Dim mServer As System.Web.Mail.SmtpMail
For i = 0 To lstEmails.Items.Count - 1 lstEmails.SelectedIndex = i .To = lstEmails.SelectedValue Try mServer.Send(MailMsg) Catch EX As Exception ErrLog = ErrLog & EX.message & "; " End Try Next End with
'Go ahead and display your ErrLog here to the user if any
NOTE: I put the mServer.Send method in a try block in case there's any of the lstEmails values that's not in email address format. That could generate an error and stop the application from sending the mail to others.
Another thing I think was the problem in your application is the introduction of the <mailto:""> tag in your .From value. As much as I know, that is not necessary.