also, you have specified 110 as your SMTP port, is it correct because default SMTP port is 25......110 is default port for POP
Main Topics
Browse All TopicsI am trying to send smtp email from an ASP.NET application. It seems pretty straight forward based on all of the examples I've found on the web.
In the code below, lines 1 & 2 execute as expected, and inspecting the objects in debugger shows that all values are assigned correctly. However, after line 3 executes, the client.Credentials object becomes null. I have no clue why, but obviously, my smtp server won't send mail without credentials. What am I missing?
using System.Web.Configuration;
using System.Net.Configuration;
using System.Net;
using System.Net.Mail;
1. SmtpClient client = new SmtpClient("myserver", 110);
2. client.Credentials = new NetworkCredential("usernam
3. client.UseDefaultCredentia
4. client.Send(message);
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm afraid that doesn't help. Additional info:
I'm running on a Win2003 server, IIS6, ASP.NET 3.5, VS2008
The SMTP server I am calling is outside of the application domain (though that shouldn't matter)
I have implemented ASP.NET Membership services, and it sends email using the exact same smtp settings (i.e. stored in in mailSettings in web.config)
I commented the line "client.UseDefaultCredenti
And I get the following error when the Send (message) method is called:
System.Net.Mail.SmtpExcept
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient
at _Default.Button1_Click(Obj
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException: System.IO.IOException
Message="Unable to read data from the transport connection: net_io_connectionclosed."
Source="System"
StackTrace:
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.CheckComma
at System.Net.Mail.MailComman
at System.Net.Mail.SmtpTransp
at System.Net.Mail.SmtpClient
InnerException:
Ya know, I checked the port and still got it wrong. In addition, I must correct my previous statement that Membership services and my inline code used the exact same values (at some point I resorted to hard coding the parms instead of reading from web.config).
So, with the correct port, I now get the following on two different dev machines. There must be something wrong with my code.
System.Net.Mail.SmtpExcept
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient
at _Default.Button1_Click(Obj
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException: System.IO.IOException
Message="Unable to read data from the transport connection: net_io_connectionclosed."
Source="System"
StackTrace:
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.SmtpReplyR
at System.Net.Mail.CheckComma
at System.Net.Mail.MailComman
at System.Net.Mail.SmtpTransp
at System.Net.Mail.SmtpClient
InnerException:
Your error message "Unable to read data from the transport connection: net_io_connectionclosed"
it seems that you are unable to connect to the server properly or server is disconnecting your session.
Have a look at this thread.
http://forums.microsoft.co
Business Accounts
Answer for Membership
by: BondinASPPosted on 2008-09-17 at 21:14:51ID: 22507417
check this e.com/Prog ramming/La nguages/.N ET/ ASP.NET /Q_2372541 0.html
http://www.experts-exchang