Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

Sending Email from vb.net console app

I am using a vb.net console program to tranfer data between a website and backoffice system. I am unable to get the program to send an email notice. I have tried a couple of variations on the code below:
 objMail.From = EmailFrom
            objMail.BodyFormat = MailFormat.Html
            objMail.Body = EmailBody
            1 - SmtpMail.SmtpServer.Insert(0, "mail.webhost4life.com")
            2 - SmtpMail.SmtpServer = "localhost"

#1 - no error but the smtpserver value is blank.
#2 - error is can't find cdo object.

Any help is welcomed.
2 Solutions
Hi there,

I have been using this component for a while now. It works great.

The mail component in .net uses the CDONTS mail component.  If you are using a machine which is pre windows 2000 it wont have CDONTS on it.  There are some installation instructions here...  http://www.webhostgear.com/204.html
Make sure you specify as much info as possible for the email, depending on the smtp server settings it could be rejecting it due to the email having no subject etc, but to be honest I don't think thats the case here, I reckon the CDONTS dll is not present on the system or is corrupted / unregistered.

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now