Solved

Sending an Email From LocalHost

Posted on 2009-06-30
16
288 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
ID: 24749110
0
 

Author Comment

by:npl77
ID: 24749445
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
ID: 24752787
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
ID: 24755204
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
ID: 24755670
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
ID: 24758548
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
ID: 24758558
I download both the client and server for telenet
0
 
LVL 12

Expert Comment

by:Hairbrush
ID: 24761303
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

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

Expert Comment

by:Hairbrush
ID: 24767620
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
ID: 24769469
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
ID: 24770626
No - that is how you installed the TELNET program.  How did you install the SMTP service (the mail server)??
0
 

Author Comment

by:npl77
ID: 24772879
I didnt maybe. How do you do it?
0
 
LVL 12

Accepted Solution

by:
Hairbrush earned 500 total points
ID: 24772988
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
ID: 24773013
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
ID: 24773365
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

24 Experts available now in Live!

Get 1:1 Help Now