Using System.Web.Mail.MailMessage in Windows Forms

  • Thread starter Thread starter Darren Gulliver
  • Start date Start date
D

Darren Gulliver

Hi,
I've written a small proof of concept application to show we can send emails
in VB.NET and it works a treat using this piece of code:

Dim myEmail As System.Web.Mail.MailMessage = New
System.Web.Mail.MailMessage()
myEmail.From = txtFrom.Text
myEmail.To = txtTo.Text
myEmail.Body = txtBody.Text
SmtpMail.SmtpServer = ""
SmtpMail.Send(myEmail)

But if I specify a mailserver in SmtpMail.SmtpServer I get this error:
Could not access 'CDO.Message' object.

Why does setting SmtpMail.SmtpServer = "" send the email?

Does this mean that using System.Web.Mail.MailMessage is reliant on having
Outlook or Outlook Express installed (Currently I have Outlook 2003
installed)?

Thanks
Darren
 
I've answered my own question too "Why does setting SmtpMail.SmtpServer = ""
send the email?"
It was using Default SMTP virtual server within IIS then sending to our mail
servers and I'm guessing the mail servers validated my PC and allowed the
email to be sent.

But will still like to know the rest of my question's

Thanks in advance
 
Darren Gulliver said:
I've written a small proof of concept application to show we can send
emails in VB.NET and it works a treat using this piece of code:

Dim myEmail As System.Web.Mail.MailMessage = New
System.Web.Mail.MailMessage()
myEmail.From = txtFrom.Text
myEmail.To = txtTo.Text
myEmail.Body = txtBody.Text
SmtpMail.SmtpServer = ""
SmtpMail.Send(myEmail)

But if I specify a mailserver in SmtpMail.SmtpServer I get this error:
Could not access 'CDO.Message' object.

=> <URL:http://www.systemwebmail.net/>
 
Back
Top