SmtpClient sending emails driectly from own computer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to usethe C# SmtpClient class to send emails but WITHOUT going
through an SMTP client out on some server. I want to do it directly from my
own machine. I specify localhost and port 80 for the SmtpClient class and it
seems to accept that, in that when I call the Send method it it doesn't
immediately come back with an error or exception, but it ends up throwing a
timeout exception.

I THINK I have the SMTP Virtual Server running on my machine OK, but it's
hard to tell. I came across documentation on installing it (and followed all
the directions) but it also includes notes on running inetmgr, which is on my
machine and registered, to set up certain settings, but I can't get it to
run.

Any suggestions would be welcome.

- Roger Garrett
 
Here are some notes I had in code:

// see http://www.systemwebmail.com/faq/4.2.3.aspx
// for common issues
// Make sure you GRANT relay privledges for "127.0.0.1"

/*
*
* Suggestion 2
If you are using "localhost" or "127.0.0.1" as
the SmtpMail.SmtpServer, you may not have permissions
to relay through the IIS SMTP Service.
To allow access, open up the IIS Admin MMC.
Locate the SMTP Virtual Server, and right-click,
then select Properties. On the Access tab, click the Relay button.
In the Relay Restrictions dialog, grant your IP address (127.0.0.1)
to the Computers listbox. Close down all dialogs,
and restart the SMTP Service.
*/

//Also check that the SMTP service is running on your machine.
 
Sloan,

Thanks for the notes. The problem is, I can't find out how to start up the
IIS Admin MMC. I followed some directions I found on the Internet directing
me to start up inetmgr but it just doesn't seem to exist on my (Windows 2000)
machine.

The instructions I came across at http://support.microsoft.com/kb/308161
told me how to install IIS and SMTP, which I did. It goes on to say:

"Click Start, point to Programs, point to Administrative Tools, and then
click Internet Services Manager." in order to handle the adminsitraive setup.

But there is NO Adminsitrative Tools item under Start/Programs. Even if I
bring up Control Panel and click the Adminstrative Tools item there, there is
nothing like Internet Services Manager there.

So, how do I determine whether SMTP is running? And how do I start up the
Admin for it? How do I restart SMTP?

- Roger
 
You gotta go to

Start / Settings / Control Panel

Add Remove Software

Windows Components (something like that?)

Then find IIS (Internet Information Services)... and also install the
optional smtp service.

You'll need the Win2000 CD, or a i386 directory from somewhere.

If you don't have those things you're dead in the water.
 
I'm trying to usethe C# SmtpClient class to send emails but WITHOUT going
through an SMTP client out on some server.

You do realise that even if you use your own SMTP server, that's then
just going to talk to another SMTP server, don't you? There may be a
benefit in terms of being able to "fire and forget" the email, letting
the local server take care of retries etc, but there won't be much
more than that.

What are you trying to avoid in not using your "real" SMTP server?
(e.g. the one that your normal mail client connects to)
I want to do it directly from my own machine. I specify localhost and port 80
for the SmtpClient class and it seems to accept that

It sounds very unlikely that your SMTP server would be using port 80 -
that's normally for web traffic. Port 25 is much more likely.

Jon
 
Jon,

Yes, I do understand that the outgoing message goes to an SMTP server on the
receiving end. And I am able to use the SMTP server that's associated with my
email address on my ISP as a relay out to the target server. But what I'm
trying to learn how to do is to use my own computer to send out emails,
without going through a "relay" on my ISP's server.

I've set up IIS and the SMTP Virtual Server on my machine. But I am unable
to run, or even locate, the manager for those in order to configure their
settings so that they will handle my mailing functions (via the SmtpClient
class).

Any help on locating and starting up that manager would be appreciated.

Alternatively, if there's a different C# class that I could use...

I believe that it's possible to send out emails from a home machine, even
without IIS and the SMTP Virtual Server, because I have some software that I
tried out that can do just that. It lets you specify an SMTP server (e.g. my
ISP's server) if you want to use a relay, OR it lets you just do it without a
relay server involved. So it seems it CAN be done. I just can't figure out
how.

- Roger
 

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

Back
Top