Page 1 of 1

Secure SMTP using STARTTLS

Posted: Sun Sep 12, 2010 8:41 am
by PhilGray
Has anyone written a "Secure" SMTP server or client recently ?

I wrote some normal SMTP functions years ago, and discovered ( after reusing the code yesterday ) that Googlemail for example now requires TLS with SMTP .

STARTTLS initiates encrypted hand-shaking between client and server.

Just wondering whether anyone has already done this ?
... or can .Net provide the functionality for this ?




SMTP Service Extension for Secure SMTP over TLS
http://www.rfc-editor.org/rfc/rfc2487.txt

Wiki - STARTTLS
http://en.wikipedia.org/wiki/STARTTLS

The Transport Layer Security (TLS) Protocol
http://tools.ietf.org/html/rfc5246

Re: Secure SMTP using STARTTLS

Posted: Sun Mar 23, 2014 4:33 pm
by MBaas
Hi Phil,

did you get any answer or have you found a solution? I'm looking at the same problem right now ;)

Thanks

Michael

Re: Secure SMTP using STARTTLS

Posted: Tue Apr 01, 2014 5:19 pm
by PhilGray
Hi Michael,
I didn't bother to follow it up as I expected that someone might answer , thus saving time & effort. Seems as if nobody has been there yet.
Cheers
Phil

Re: Secure SMTP using STARTTLS

Posted: Tue Apr 01, 2014 7:41 pm
by MBaas
Thanks, Phil. How sad :((

Is anyone from Dyalog listening? This should be a project for one of your youngsters - it can't be that "nobody has ever been there" (in 2014)!

Cheers

Michael

Re: Secure SMTP using STARTTLS

Posted: Tue Apr 01, 2014 10:34 pm
by PhilGray
Michael,
I agree , although my guess is that most people are probably using DotNet these days .. where the "wheel" doesn't have to be reinvented but is available in some Library.
Hint .. some input or tips from the Dyalog guys would be helpful here.
;-)

Re: Secure SMTP using STARTTLS

Posted: Wed Apr 02, 2014 2:06 pm
by Vince|Dyalog
Hi Phil,

I found this webpage which may be of interest:

http://msdn.microsoft.com/en-us/library/system.security.authentication.sslprotocols(v=vs.110).aspx
Regards,

Vince

[Post updated to fix URL - thanks Phil!]

Re: Secure SMTP using STARTTLS

Posted: Wed Apr 02, 2014 3:27 pm
by PhilGray
Thanks Vince .. dead-link somehow.

I guess you meant this one ?

http://msdn.microsoft.com/en-us/library/system.security.authentication.sslprotocols(v=vs.110).aspx

Seems that .net Framework 4.5 supports TLSv1.2

Re: Secure SMTP using STARTTLS

Posted: Sun May 25, 2014 9:41 am
by MBaas
The following should help (requires .net 4.5)
      ⎕USING←'System.Net.Mail,System.dll' 'System,System.dll' 'System.Net,system.dll'
MyMail←MailMessage.New ⍬
MyMail.To.Add ⎕NEW MailAddress,⊂'bill@microsoft.com'
MyMail.From←⎕NEW MailAddress,⊂'sales@dyalog.com'
MyMail.Subject←'Your 500 licences of Dyalog APL'
MyMail.Body←'Thanks, Bill. Nice to see you returning to APL :)'
Mailer←⎕NEW SmtpClient(,⊂'smtp.dyalog.com')(587) ⍝ SMTP-Server and port
Mailer.EnableSSL←1
Cred←⎕NEW NetworkCredential('smtp_USERNAME' 'smtp_PASSWORD')
Mailer.UseDefaultCredentials←0
Mailer.Credentials←Cred
Mailer.Send MyMail

Re: Secure SMTP using STARTTLS

Posted: Tue Nov 11, 2014 3:23 pm
by Dick Bowman
That didn't quite work for me (LENGTH ERRORs) needed to change lines...

Code: Select all

 MyMail.To.Add ⎕NEW MailAddress,⊂'bill@microsoft.com'
 MyMail.From←⎕NEW MailAddress,⊂'sales@dyalog.com'

to

Code: Select all

 MyMail.To.Add ⎕NEW MailAddress (⊂'bill@microsoft.com')
 MyMail.From←⎕NEW MailAddress (⊂'sales@dyalog.com')