System.Web.Mail in a console app?

E

ES

Hello,
I have very simple console app that attempts to send an email using
system.web.mail. I compiles and runs without any errors but doesn't send
anything. I've checked the badmail folder, etc and I don't see anything.

Should the mail object work in a console app? I've changed the addresses
shown for this message. The actual programm had valid addresses.

The entire program is:

Imports System.Web.Mail
Module Mailer
Sub Main()
Dim m As MailMessage = New MailMessage
m.To = "(e-mail address removed)"
m.From = "(e-mail address removed)"
m.Subject = "The webserver SMTP service is running"
m.Priority = MailPriority.Low
m.Body = "The webserver SMTP service is running at: " &
CStr(DateTime.Now)
m.BodyFormat = MailFormat.Text
SmtpMail.Send(m)
End Sub
End Module
 
E

ES

Thanks for replying
Adding the line
SmtpMail.SmtpServer = "webmail.myservername.com"

results in an unhandled httpexception, "Could not access CDO.Message
object".

I use my original code in aspx web pages successfully, and I use cdonts with
asp classic pages successfully all the time. Any other thoughts? I'm
willing to try anything.

The point of this is to do some console apps to replace vbs scripts I use
for various things that don't have a UI...

Elton
 
E

ES

Per your suggestion, I looked up that property in the help. Oops. The
local smtp server doesn't go there, the relay server does. I've got it
going on my local machine, relaying through exchange.

It's still not going anywhere on the web server, which doesn't use a relay
server though.

Elton
 
E

ES

ARRRHGGGHH!!!!!

It also seems that it helps if your Exchange admin doesn't blow away your
alias!
It's working

Thanks
Elton (what's the emoticon for blushing?)
 

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