Secure SMTP using STARTTLS

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
Post Reply
PhilGray
Posts: 50
Joined: Sat Mar 13, 2010 7:55 pm

Secure SMTP using STARTTLS

Post 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
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Secure SMTP using STARTTLS

Post 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
PhilGray
Posts: 50
Joined: Sat Mar 13, 2010 7:55 pm

Re: Secure SMTP using STARTTLS

Post 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
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Secure SMTP using STARTTLS

Post 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
PhilGray
Posts: 50
Joined: Sat Mar 13, 2010 7:55 pm

Re: Secure SMTP using STARTTLS

Post 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.
;-)
Vince|Dyalog
Posts: 439
Joined: Wed Oct 01, 2008 9:39 am

Re: Secure SMTP using STARTTLS

Post 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!]
PhilGray
Posts: 50
Joined: Sat Mar 13, 2010 7:55 pm

Re: Secure SMTP using STARTTLS

Post 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
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Secure SMTP using STARTTLS

Post 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
User avatar
Dick Bowman
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm
Contact:

Re: Secure SMTP using STARTTLS

Post 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')
Visit http://apl.dickbowman.com to read more from Dick Bowman
Post Reply