Solved

Sending an Email From LocalHost

Posted on 2009-06-30
16
287 Views
Last Modified: 2012-05-07
Is there anyway to send a email from your application using localhost. I tried this, but doesnt work.
<system.net>

      <mailSettings>

        <smtp deliveryMethod="Network">

          <network host="localhost" port="25" />

        </smtp>

      </mailSettings>

    </system.net>

Open in new window

0
Comment
Question by:npl77
  • 8
  • 7
16 Comments
 
LVL 7

Expert Comment

by:urir10
Comment Utility
0
 

Author Comment

by:npl77
Comment Utility
I did that....
Im getting this exception
No connection could be made because the target machine actively refused it 127.0.0.1:25
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Hi npl

If you've installed the SMTP service on your machine but it is not fully working then you could try following the steps listed on this site: http://thedaneshproject.com/posts/send-mail-through-smtp-using-telnet/

This will enable you to identify the specific problem that your SMTP service is having.
0
 

Author Comment

by:npl77
Comment Utility
Where do I "key in" this stuff. Can you expand on exactly what to do in the steps from the url posted. I dont know what it means to...

Telnet to the server via port 25.    <------How do you do this?

1. Key in EHLO example.com and hit enter.        <------How do you do this?
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Hi again

It would help to know what operating system is the server running on?

Basically you need to run TELNET from the command line, so you'd click Start->Run and enter CMD to bring up a command prompt, then you'd enter TELNET localhost 25

Assuming you have TELNET installed, you'll then connect to the service that is listening on the TCP/IP port 25 (which will be your SMTP server)
If however TELNET is not installed and you get an "unknown command or filename" type message, you'll need to first install it by going in to Control Panel and Add/Remove Programs (Programs and Features in Windows Server 2008 or Vista) and then "turn windows features on or off" and then add TELNET from the options you see there.
Basically TELNET lets you talk directly to the SMTP service without the nice GUI interface that a normal e-mail client would give you, and lets you type in raw email commands and see extactly what messages and errors your mail server is returning.
0
 

Author Comment

by:npl77
Comment Utility
I am using my laptop Vista Home OS. I just installed TELENET but its saying it cannot open a connection on port 25
0
 

Author Comment

by:npl77
Comment Utility
I download both the client and server for telenet
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Do you have Windows Firewall enabled?  If so, you'll need to either disable it or to allow SMTP traffic to your SMTP server on port 25.

Please click Start->Control Panel->Windows Firewall.  Does it say that the firewall is on or off?

If it is on, click "Allow a program through Windows Firewall".  From the Exceptions tab, scroll down and you should see SMTP.  Check the box and click OK.  Then retry the TELNET test.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:npl77
Comment Utility
i do not have the windows firewall on and it still doesnt work
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
If it is saying that it cannot open a connection, it sounds like your SMTP server is not correctly installed.  Can you tell me the steps you took to install and configure the SMTP service?
0
 

Author Comment

by:npl77
Comment Utility
Went to Windows features and checked TELNET client and TELNET server then they installed successfully and after that I got rid of the "unknown error" when typing TELNET localhost 25 in the command prompt. After that I made sure my firewall was off and it was.
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
No - that is how you installed the TELNET program.  How did you install the SMTP service (the mail server)??
0
 

Author Comment

by:npl77
Comment Utility
I didnt maybe. How do you do it?
0
 
LVL 12

Accepted Solution

by:
Hairbrush earned 500 total points
Comment Utility
Well, that turns out to be a bit of a trick question of mine, because it turns out that there is no SMTP service in Vista.  You will need to install one from a third-party.

You could try the free one at http://softstack.com/freesmtp.html

0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
By the way, the reason I thought you had already installed an SMTP server when Uri sent you a link to instructions on how to install the SMTP server (on Windows Server) you replied "I did that...."
0
 

Author Comment

by:npl77
Comment Utility
Ok I installed that and tried again still the same error. Do I have to do something besides simply installing the free SMTP?
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now