Tried to read a line. Only ” received.
Mail.dll
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.
Similarly Norton Security scans outgoing messages (‘Scan outgoing email messages’ feature is on even when antivirus is disabled) and breaks as it has incorrectly implemented CHUNKING mechanism.
Some Cisco Pix and Cisco ASA firewall may interfere with SMTP traffic when SMTP Packet Inspection is on.
In most such cases turning on SSL/TLS prevents external programs from snooping and breaking the traffic.
Generally ‘Tried to read a line.’ 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.
Mail.dll for Windows Store
If you are using Mail.dll for windows store applications: Connect and ConnectSSL methods are asynchronous. You must use await ConnectSSL and await Connect:
// C# using(Imap imap = new Imap()) { await client.ConnectSSL("imap.example.com"); await client.UseBestLoginAsync("user", "password"); // ... }
' VB.NET Using imap As New Imap() Await client.ConnectSSL("imap.example.com") Await client.UseBestLoginAsync("user", "password") ' ... End Using
All points in Mail.dll section apply as well.