0 votes

I try connect to smtp server over proxy. smtp.Attach not working. Its raise error. Proxy working correct.

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

My code below

ProxyFactory factory = new ProxyFactory();
IProxyClient proxy = factory.CreateProxy(
    Limilabs.Proxy.ProxyType.Socks5, 
    "94.177.197.139", 
    9696);

var socket = proxy.Connect(server, 465);

using (Smtp smtp = new Smtp())
{
    smtp.Attach(socket);

    smtp.UseBestLogin(login, password);

    ISendMessageResult result = smtp.SendMessage(email);

    if (result.Status == SendMessageStatus.Success)
        Console.WriteLine("Success!");
    else
        Console.WriteLine("Failed!");

    smtp.Close();
}
by (930 points)

1 Answer

+1 vote

You are using port 465 to connect to SMTP service. By default this is port is used for SMTP over SSL/TLS.

Please try using smtp.AttachSSL instead of smtp.Attach. This causes SSL/TLS negotation to be performed immediately on attached connection.

by (297k points)
edited by
...