0 votes

I made a connection to an SMTP server via the function Connect in VB.Net, I have this error message:

Tried to read a line. Only '' received. Please make sure that antivirus and firewal software are disabled or configured correctly.

Thank you.

Using smtp As New Smtp()

    smtp.Connect(_ServeurSMTP, _PortSMTP)
    AddHandler smtp.ServerCertificateValidate, AddressOf ValidateSMTP

    smtp.StartTLS()

    smtp.UseBestLogin(_UserName, _Pss)

    Dim builder As New MailBuilder()
    builder.From.Add(New MailBox(AdrMail, "Service PARC AUTO"))
    builder.[To].Add(New MailBox(DestMail, DestName))

    builder.Subject = "Relevé kilométrique"
    builder.Text = " Bonjour...."
    Dim email As IMail = builder.Create()

    Dim result As ISendMessageResult = smtp.SendMessage(email)
    If result.Status = SendMessageStatus.Success Then
        ' Message was sent.       
    End If
    smtp.Close()
End Using
by (200 points)

1 Answer

0 votes

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.

It is important to know when did this exception occur.

If at Smtp.Connect method, most likely you are using incorrect port (default for email submission is 587, 25 is sometimes used as well), or your server requires SSL/TLS (Use Smtp.ConnectSSL)

If later on there is a good chance that antivirus is interfering - turn it of for testing and configure it properly later on.

You can find more details on this error here:
https://www.limilabs.com/blog/tried-to-read-a-line-only-received

by (301k points)
...