I am writing a C++ program for sending emails automatically. I downloaded sample code which uses SMTP for sending emails. But the program is not working. When we are calling gethostbyname("smtp.gmail.com") I get an error:WSAHOST_NOT_FOUND.

To send emails I had to log in a proxy server. I manually logged in the proxy server and then only I tried my program.

Please help me.