Tried to read a line. Only ” received.


If you are using Mail.dll:

Please make sure that you have disabled antivirus and firewall software or that you have configured them correctly. This includes Windows Defender – especially if you use SMTP client.

Many reports show that AVG antivirus tracks IMAP sessions and interrupts them with no reason.

In most cases this error means that the connection was interrupted. It was lost, the server disconnected or your antivirus/firewall cut the connection. For instance: SMTP server may be configured to disconnect as soon as it decides your message is spam or when you are using incorrect from address.

In technical terms, it means exactly what the exception’s message says: component tried to read a line (ending with CRLF), the line was expected in accordance to the protocol in use, but it has not been received during the specified period.

On extremely slow networks you may increase timeout values: ReceiveTimeout and SendTimeout.

If increasing timeout values doesn’t help, it means that the connection was dropped by the remote server or some intermediary router – you’ll need to connect again.

If you are using *Imap.Idle* you can use lower IDLE timeout. It specifies timeout after which IDLE command is re-issued. This breaks inactivity period (which happens when no new message is delivered) and thus prevents routers from cutting the connection.


If you are using MailForWindowsStore.dll: Connect and ConnectSSL methods are asynchronous. You must use await ConnectSSL and await Connect:

// C#

using(Imap imap = new Imap())
    await client.ConnectSSL("");
    await client.UseBestLoginAsync("user", "password");
    // ...

Using imap As New Imap()
    Await client.ConnectSSL("")
    Await client.UseBestLoginAsync("user", "password")
    ' ...
End Using

All points in Mail.dll section apply as well.

Tags: , ,


Consider using our Q&A forum for asking any questions.