D
David Cho
I am having trouble using System.Web.Mail to send emails from a desktop
application. The following is my code.
MailMessage _mail = new MailMessage();
_mail.From = "(e-mail address removed)";
_mail.To = "(e-mail address removed)";
_mail.Subject = "howdy";
_mail.Body = "how's your dad?";
_mail.BodyFormat = MailFormat.Text;
// set the default smtp server & send it
SmtpMail.SmtpServer = "mail.smtp.com";
SmtpMail.Send(_mail);
On the SAME MACHINE, running this as a web application works, but
running it as a console application results in
"An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll Additional information: Could not access 'CDO.Message'
object."
Strangely, this code used to work, but it does not work anymore. Why
would running it as a web application (on the same machine) work? Is
System.Web.Mail for ASP.NET only? What is the alternative for a desktop
application? I really want to avoid having to use Outlook. Really do.
application. The following is my code.
MailMessage _mail = new MailMessage();
_mail.From = "(e-mail address removed)";
_mail.To = "(e-mail address removed)";
_mail.Subject = "howdy";
_mail.Body = "how's your dad?";
_mail.BodyFormat = MailFormat.Text;
// set the default smtp server & send it
SmtpMail.SmtpServer = "mail.smtp.com";
SmtpMail.Send(_mail);
On the SAME MACHINE, running this as a web application works, but
running it as a console application results in
"An unhandled exception of type 'System.Web.HttpException' occurred in
system.web.dll Additional information: Could not access 'CDO.Message'
object."
Strangely, this code used to work, but it does not work anymore. Why
would running it as a web application (on the same machine) work? Is
System.Web.Mail for ASP.NET only? What is the alternative for a desktop
application? I really want to avoid having to use Outlook. Really do.