views:

57

answers:

0

So I wrote this program to send a group of my friends a text message. It works fine at home when I try to use it at work it doesn't work. I get an error message "Failure Sending Mail".

We are using a intercepting proxy at work. I though/hoped that everything would just work, clearly not.

So what do I need to do, I've never programmed to connect/send traffic through a proxy.

I'm using C# and the SmtpClient class to send the message. Here's a little snippet.

SmtpClient client = new SmtpClient(emailType.Address, emailType.Port);
client.Credentials = new System.Net.NetworkCredential(tbxAccountUser.Text, tbxUserPassword.Text);
client.Send(message);

I talked to our IT department and I have the IP that they are using but I wasn't sure what I need. I'm not even sure what class to use...

I tried this:

WebRequest myWebRequest = WebRequest.Create("http://www.google.com"); WebProxy myProxy = new WebProxy(); // Obtain the Proxy Prperty of the Default browser.
myProxy = (WebProxy)myWebRequest.Proxy;

        Uri newUri = new Uri("http://"+ ip +":8080");

        // Associate the new Uri object to the myProxy object.
        myProxy.Address = newUri;

        // Create a NetworkCredential object and is assign to the Credentials property of the Proxy object.
        myProxy.Credentials = new NetworkCredential(userName, passWd);
        myWebRequest.Proxy = myProxy;

Im not sure if I can set this to my SmtpClient client?

Thanks