Proposed fix for Ticket #17 (Email not send if attachment used)
Fix: Adding an attachment results to error '554 Too long line was received.' from server.
Fix: Adding an attachment results to error '554 Too long line was received.' from server.
Attachment is sent as a base64-encoded string and it looks like some email servers (hMailServer in my case) have limits for string length . So basically I just split one huge line to smaller parts.
Had the same issue, mail server reported: "554 Too long line was received" when I tried to add an attachment. Fixed it by adding "\r\n" to stream chunks in SmtpSocketClient.cs, at the end of SendAttachments() method: ... char[] bufln = new char[2] { '\r', '\n' }; while (num > 0) { _con.SendData(Encoding.ASCII.GetChars(fbuf, 0, num), 0, num); _con.SendData(bufln, 0, 2); // <-------- num = cs.Read(fbuf, 0, 2048); } ...