Friday, May 6, 2011

Sending mail throught http proxy

Hi,

I'm trying to send emails from a system that connects to internet through a http proxy which is set in Internet Options.

i'm using SmtpClient.

Is there any way to send mails with SmtpClient through this proxy setting. Thanks

From stackoverflow
  • Http Proxies control http traffic, they rarely have anything to do with SMTP at all. I've never heard of proxying SMTP before after all SMTP itself is intrinsically supports a chain of "proxies" to the destination SMTP server.

    Chuck Conway : You could proxy SMTP to say a spam filter. Where the spam filter would evaluate the email and forward it on to the SMTP server.
    AnthonyWJones : @Charles: Like I said in the answer STMP is intrinsically a series of "proxies" to the destination. A spam filter is simply another SMTP server in the chain.
    Salar : I believe it is possible. Clever components implemented one: http://www.clevercomponents.com/products/inetsuitenet/smtpclientnet.asp but it doesn't seem worth buying it
  • If the only access you have to the internet is through HTTP, then pretty much the only way you'll be able to do this is by setting up a VPS (or equiv) with SSH on port 443 and using corkscrew (or putty) to tunnel ssh through. From there it is a simple matter to forward smtp traffic over your ssh tunnel.

    Be aware that you may be violating the companies computing policy if you do this.

  • I understand that you want to use the browsers default settings, i would also like an answer for that.

    Meanwhile, you could do it manually.

        MailAddress from = new MailAddress("from@mailserver.com");
        MailAddress to = new MailAddress("to@mailserver.com");
    
        MailMessage mm = new MailMessage(from, to);
        mm.Subject = "Subject"
        mm.Body = "Body";
    
        SmtpClient client = new SmtpClient("proxy.mailserver.com", 8080);
        client.Credentials = new System.Net.NetworkCredential("from@mailserver.com", "password");
    
        client.Send(mm);
    

0 comments:

Post a Comment