0 votes
by (190 points)

Hello,

tried to connect to mail.gmx.net using a HTTP(Connect)-Proxy for sending an email and get the error "Unable to resolve hostname"

Here is my source-code:

        MailMessage message = new MailMessage();

        message.From = "xxx@gmx.net";
        message.To = "123@gmail.com";
        message.Subject = "This is a test message";
        message.BodyText = "Hello, Joe!";
        message.BodyHtml = "Hello, <b>Joe</b>!";

        Smtp smtp = new Smtp();

        smtp.Proxy.ProxyType = ProxyType.HttpConnect;
        smtp.Proxy.Host = "myproxy";

        smtp.Proxy.Port = 80;
        smtp.Proxy.UserName = "user";
        smtp.Proxy.Password = "pass";


        smtp.Connect("mail.gmx.net", SslMode.Explicit);
        smtp.Login("xxx@gmx.net", "password");


        smtp.Send(message);

What am I doing wrong?

Thank you for your appreciated help.

by (144k points)
This looks like the proxy is unreachable. However, to make sure, please create a log using Smtp object's LogWriter property (as described at https://rebex.net/kb/logging/) and either post it here or mail it to support@rebex.net. This should make it possible to tell what is going on.

1 Answer

0 votes
by (190 points)

Thank you for your fast response.

I found out that the error was caused by the "proxy-issue" introduced in version 2017 R5, that was fixed with the R6 version ("Proxy: Fixed handling of IP-based host names in proxy name resolving routine (an issue introduced in previous release").
So I just updated to the latest version and now it works fine.

by (144k points)
Thanks for letting us know, and sorry for inconvenience!
...