I want to send mail using gmail smtp via my proxy. I'm getting an error- An unhandled exception of type 'System.IO.IOException' occurred in System.dll
Additional information: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I'm using the following code-
MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("subhannitatesting@gmail.com", "Alice"));
builder.To.Add(new MailBox("subhannitasarcar1994@gmail.com", "Bob"));
builder.Subject = "subject";
builder.Html = "testing";
IMail email = builder.Create();
ProxyFactory factory = new ProxyFactory();
IProxyClient proxy = factory.CreateProxy(
ProxyType.Http,
"10.3.100.207",
8080);
Socket socket = proxy.Connect("smtp.gmail.com", Smtp.DefaultPort);
using (Smtp smtp = new Smtp())
{
smtp.Attach(socket);
smtp.UseBestLogin("subhannitatesting@gmail.com", "password");
ISendMessageResult result = smtp.SendMessage(email);
if (result.Status == SendMessageStatus.Success)
Console.WriteLine("Success!");
else
Console.WriteLine("Failed!");
smtp.Close();
}
Thanks from advance!