locked
Unable to read data from the transport connection:

    Question

  • hi, i am trying to send email using VB2005 but i am getting this Exception.
    "System.IO.IOException = {"Unable to read data from the transport connection: net_io_connectionclosed."}"
    while from same machine i am able to send email with same SMTP server from OutLook Express.
    what could be the reason?
    Tuesday, May 23, 2006 7:57 AM

Answers

All replies

  • hi,

    Please go through the link below. It has a sample code in it.Hope this helps.
    Link: http://www.jscape.com/articles/sending_email_using_vb.html

    Thank you,
    Bhanu.

     

    Friday, May 26, 2006 12:17 AM
  • Hi bhanu

    The link you provided refres to using the Email Factory component and is not helpful if one is using the System.Net.Mail namespace.

    I am getting this error while trying to send mail using the system.Net.Mail what is the cause and resolution for this error ?

    This is my code

    Dim objSMTPclient As New System.Net.Mail.SmtpClient

    Dim objMailMessage As New MailMessage

    objMailMessage.From = New MailAddress("M@M.Com", "Mail Man")

    objMailMessage.To.Add(a@b.com)

    objMailMessage.Subject = "Message Subject"

    objMailMessage.Body = "Message Body"

    objSMTPclient.Host = "Localhost"

    objSMTPclient.PickupDirectoryLocation = "C:\Inetpub\mailroot\Queue"

    Try

    objSMTPclient.Send(objMailMessage)

    Catch ex As Exception

    End Try

    This works well in my development environment (win XP pro) but fails on my test server (win 2000) with the following error

    Failure sending mail.
    System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
       at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
       at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
       at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
       at System.Net.Mail.SmtpReplyReader.ReadLine()
       at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
       at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
       at System.Net.Mail.SmtpClient.GetConnection()
       at System.Net.Mail.SmtpClient.Send(MailMessage message)

    Wednesday, June 28, 2006 9:31 PM
  • it sounds like you are behind a firewall or some thing like wise.
    in my case same thing was happening, a firewall on my pc was preventing me.
    Thursday, June 29, 2006 12:36 PM
  • objSMTPclient.PickupDirectoryLocation = "C:\Inetpub\mailroot\Queue"
    TryobjSMTPclient.Send(objMailMessage)           ' Should be linefeed after try
    Catch ex As Exception
    End Try

    If this is just a typo I don't know what's wrong,
    otherwise you should edit that.

    Grtz, Tom.

    Thursday, June 29, 2006 1:20 PM
  • Tom,

    yea that was a typo sorry about that. I fixed that now

    Secrets
    I dont think it is a problem with a firewall in my case since the code works on my development machine but not on on the test server. both machines are on the same network and on the same side of the firewall.

    The test server is a win 2000 server with no built in firewall and the windows firewall on my development Win XP machine is turned off.

    I think it has to do with the security and permissions of the account under which the compiled and deployed code is running but I dont know enough about windows/SMTP security to say for sure. Anybody know of a good book or resource wher I can learn about this stuff?

    For instance what are the security implications of specifying the following in my code?

    objSMTPclient.PickupDirectoryLocation = "C:\Inetpub\mailroot\Queue"

    thanks

    Vikram

    Friday, June 30, 2006 11:29 AM
  • I'm having a weird case of this problem. I've done the obligatory Google search on the "net_io_connectionclosed" issue and have found numerous postings from people with the problem. However, I've not yet seen a good solution, or a solution that applies to my case.

    I've set up an ASP.net page (2.0) to send out weekly Newsletters to my subscriber database (7500+ email addresses). When I attempt to send the emails I get this error... BUT... it does in fact send some of the emails off first. I've not established the exact number of emails sent, but it is at least 50. So, the typical reasons for this error message obviosuly don't apply: the SMTP is set up fine, and its not a firewall issue.

    Any ideas? This is driving me nuts... my code clearly works fine, or else no emails would be sent.... so how exactly do I fix this problem?

     

     

    Saturday, July 01, 2006 6:45 PM
  • Hi Nevyn32
    I managed to fix the problem I had, it seemed to be the SMTP settings. Im not sure what exactly the problem was but this is what fixed it.

    Open the SMTP properties

    Under the General tab

    IP address - All unassigned (set this per your secutrity needs)

    Limit number of connections Checked on and value is 10 (Check if your code has multiple SMTP connections at any given time)

    Connection time out Mins 10

    Enable Logging Checked on - This may give you some idea of what the problem is in your case

    Under Access tab

    Access Control - Click the Authentication button - Check on Anonymous Access and uncheck the rest

    Check your Connection control and relay restrictions per your security needs

    Under Messages tab

    You may want to check your settings here as this is where limitations of the number of recipients of a message are set

    You may consider disabling some restrictions or increasing the limits for the number of recipients per message

     I believe the net_io_connectionclosed error message is mostly related to the SMTP settings and other security patches that were recently released by MS. but Im just speculating there.

    Do post your resuls back here.

    Best

    Vikram

    Sunday, July 02, 2006 1:09 AM
  • Make sure you can relay (Relay button) and Connect (Connection button)...

    Both of these have to be set for you to succesfuly send mail this way.

    Cheers,
    Matei

    Tuesday, July 11, 2006 7:52 PM
  • Hello,

    I have received the same error when trying to send email using System.Net.Mail.  One thing I noticed is if I use objSMTPclient.Host = "Localhost" like you do then I get the same error as you.  However, if I set this property to the IP Address of the server instead of "Localhost" then the email messages are sent successfully.  You may try using the IP Address of the machine to see if it solves your problem.

    Paige Ake, MCSD

     

    • Proposed as answer by Splaktar Monday, March 21, 2011 4:20 PM
    Thursday, July 13, 2006 4:06 PM
  • Hi there, using the explicit IP address of the server solved this for me. Thank you!

    Cheers,
    Matt

    • Proposed as answer by Splaktar Monday, March 21, 2011 4:20 PM
    Monday, July 17, 2006 8:05 PM
  • Thanks!
    This did it for me!

    /flix
    Sunday, September 24, 2006 1:26 PM
  • hi peoples ;

    A thank you note for the advise on SMTP setup

     

    if followed the post by;

    Vikram Karumbaiah 


    Posts 6
     and also followed

    mateid 


    Posts 2

     

    posts inserting my domain name as relay (Relay button) and Connect (Connection button)...Authoritized 

     

     

    thanks for the post and ideas  

    Thursday, April 26, 2007 11:08 AM
  •  

    Finally I found the reason for the error:

     

    Some of you solve the problem when turn off integrated autentificaion on configuration tab of SMTP.

    The problem is that the user who execute your ASP application doesn't have permisions to access SMTP server.

     

    try adding credential to the

    CredentialCache object

     

     

     

    for instance.. if you are running a windows app, simply add

    client.Credentials = CredentialCache.DefaultNetworkCredentials;

     

    and .NET takes the user who run the application to log into the smpt if needed.

     

    regards

    • Proposed as answer by Duggie Wednesday, July 15, 2009 10:54 AM
    Monday, May 21, 2007 7:42 PM
  • Gr8!

    it worker for me..Smile
    Sunday, September 30, 2007 5:44 PM
  • Gr8!

    it worked for me..Smile
    Sunday, September 30, 2007 5:44 PM
  • Yep, this is it..

    CredentialCache

     

    creds = new CredentialCache();

    creds.Add(

    "auth.smtp.1and1.co.uk", 25, "LOGIN", new NetworkCredential("jdoe@xyx.com", "passwordddd"));

    emailClient.Credentials = creds;


    C# developer
    • Proposed as answer by Duggie Wednesday, July 15, 2009 10:56 AM
    Wednesday, July 15, 2009 10:56 AM