[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I connect to an smtp server through a proxy using SSL in C#.NET?

Posted on 2009-02-23
4
Medium Priority
?
1,879 Views
Last Modified: 2013-11-30
I am writing a program to send mail and have come to a problem trying to get SSL to work with a proxy server as well. I have managed to successfully send mail using .NET's built in SmtpClient and enable TLS etc but I haven't found a way to do this routed through a proxy server. I have found a proxy socket implementation at mentalis.org which can connect to proxys which I have also got working but then I have to somehow implement the SSL communication manually which i'm really not sure how to do.
0
Comment
Question by:bossmonkey666
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:rowansmith
ID: 23718507
SSL and TLS are not compatible transport layers.

Did you want to connect to an SMTP-SSL server or a SMTP-TLS Server?

If it is SMTP-SSL then you can create a SSL Tunnel between your application and the endpoint via the proxy and then just use the SMTP Client as if you are talking to a non encrypted SSL Service.  If it is TLS then you will not be able to connect via the proxy unless it is a SOCKS/TLS proxy.

-Rowan
0
 

Author Comment

by:bossmonkey666
ID: 23718538
Oh I see, I was under the impression they were very similar protocols. Okay the SMTP servers i've tried are TLS I believe: smtp.gmail.com and smtp.aol.com both need you to supply "STARTTLS" before you can give it the email information. So does this mean I would be looking out for SOCKS/TLS proxies only? Or is this possible through say SOCKS5
0
 
LVL 11

Accepted Solution

by:
rowansmith earned 2000 total points
ID: 23718571
While TLS and SSL are essentially the same from an encryption perspective, the fundamental difference is:

TLS - Connects in Cleartext and then initiates SSL via the use of commands such as STARTTLS.

SSL - Connects and straight away, begins an encrypted Hand-Shake process to establish an encrypted session.

I believe the standard for SMTp-SSL is port 465, where as TLS is just an encrypted stream over that standard Port 25.

For TLS you will need to use a SOCKS proxy server that allows you to make an outbound connection on port 25.

0
 

Author Closing Comment

by:bossmonkey666
ID: 31550457
Cheers
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question