Resolve "Could not access 'CDO.Message' object" error
There could be few reasons for this error you can try suggestion sprovided below
Workaround 1
The email address does not have a valid TO address. After iterating through the InnerExceptions, you may find this error message actually has to do with relaying. Try sending a test email to an email address that exists on the server specified by SmtpMail.SmtpServer. If you can send an email to that server, then it is a relay issue. Talk to your mail server administrator about letting your code relay through the mail server.
Workaround 2
Use a real FROM address that exists on the SmtpMail.SmtpServer. Do not use something like "asdf@asdf.com", or some other bogus address as your MailMessage.FromProperty. More advanced mail servers will catch this, and will deny relaying.
Workaround 3
I have no idea why this suggestion works, but I found it on the web. I figured I would mention it, just in case Suggestion 1 did not work. Instead of specifying
SmtpMail.SmtpServer = "127.0.0.1"try
SmtpMail.SmtpServer.Insert( 0, "127.0.0.1 or your mail server name here")
Comments