Erm, sending Email... it's not working!!! :(

G

Guest

Hiya, I've had a good poke around the System.Web.Mail class, and I 'think' everything is okay, but, I just cannot get it:

[CODE
using System
using System.Web.Mail

namespace ConsoleApplication

/// <summary
/// Summary description for Class1
/// </summary
class Class

/// <summary
/// The main entry point for the application
/// </summary
[STAThread
static void Main(string[] args

MailMessage DabzMail = new MailMessage()
DabzMail .From = "(e-mail address removed)"
DabzMail .To = "(e-mail address removed)"
DabzMail .Subject = "Blah"
DabzMail .Body = "hehehehehehe"

SmtpMail.SmtpServer = "mail.btinternet.com"
SmtpMail.Send(DabzMail)




[CODE

I also add a reference to System.Web.dll

When I compile using Debug/Start, a warning window pops up saying:

"An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dl

Additional information: Could not access 'CDO.Message' object.

Anyone explain what's happening... My Visual C# Step by Step book doesnt explain this sorta stuff!!! ;

Dab

:
 
G

Guest

Bugger, I meant 'System.Web.Mail namespace!!! ;)

Anyway, it's only when I hit the

Code:
SmtpMail.Send(DabzMail);
[CODE]

line, that it throws an exception???

Cheers

Dabz

:)
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?RGFieg==?= said:
I also add a reference to System.Web.dll.

When I compile using Debug/Start, a warning window pops up saying:-

"An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll

Additional information: Could not access 'CDO.Message' object."

CDO has quite a few issues like this. Try this instead:

http://www.codeproject.com/useritems/IndySMTP.asp


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top