Page 2 of 6
Re: 32 bit SSL SMTP
Posted: Sat Jul 20, 2013 8:16 pm
by IdeasVacuum
I tried this code last night, PB5.11, worked like a charm. Tonight, it fails - "Bad argument, parameter 3". Have not changed any of the parameters, so does anyone know what is happening?
Edit: To be absolutely sure, I copied and pasted the code again. The only things requiring change are the mailFrom, userName, password, mailTo and an extra #CRLF$ to seperate the Subject line from the body. Still no-go with the parameter 3 error.
Re: 32 bit SSL SMTP
Posted: Sat Jul 20, 2013 9:51 pm
by RichAlgeni
Can you trap out where in the code the error is coming from?
Re: 32 bit SSL SMTP
Posted: Sat Jul 20, 2013 10:58 pm
by IdeasVacuum
I'm working on that now - decided to leave it for a while as sometimes the most obvious things are not spotted with a tired brain.

Re: 32 bit SSL SMTP
Posted: Sat Jul 20, 2013 11:29 pm
by IdeasVacuum
It fails when adding the Server Name.
CryptSetAttributeString() 3rd parameter is *mailHost, which (correctly) = "smtp.gmail.com" - Checked using PeekS(*mailHost)
Oh, there it is, right under my nose - compiler set to Unicode. Works fine non-unicode.......
Re: 32 bit SSL SMTP
Posted: Sat Jul 20, 2013 11:39 pm
by IdeasVacuum
....so, having trouble getting it to work with unicode - is it the case that the cryptlib32.dll does not accept unicode strings?
Re: 32 bit SSL SMTP
Posted: Sun Jul 21, 2013 12:35 am
by RichAlgeni
Can you use ascii for everything but the body of the email, then switch to unicode? Not sure if that's possible.
Re: 32 bit SSL SMTP
Posted: Sun Jul 21, 2013 12:40 am
by RichAlgeni
Or is it possible that unicode is just used as an attachment???
Re: 32 bit SSL SMTP
Posted: Sun Jul 21, 2013 12:00 pm
by IdeasVacuum
Hi RichAlgeni
Can you use ascii for everything but the body of the email, then switch to unicode? Not sure if that's possible.
That might well be possible I think, but the email facility in my app is only a small part of the functionality, all of which is Unicode. So, got to put my thinking hat on again ~difficult because the UK has a heatwave on and we are just not made for temperatures above 10 degrees

Re: 32 bit SSL SMTP
Posted: Mon Jul 22, 2013 12:33 pm
by IdeasVacuum
Well, I can "Asciifi" the User info and server handshakes/error messages with tons of Pokes and Peeks - but whilst wading through the changes, I realised that it would just not be good enough because Users could have Unicode Names/Passwords/Subject/Body, and things like foreign language accents would be lost - or in the case of Chinese characters for example, everything would be lost. Gmail supports Unicode, my app is in Unicode, so I must find a way of using the Gmail server in Unicode.
Edit: Well in fact, looks as though it's possible to do it without encryption of everything (so no cryptlib), which is unnecessary in my case, so more experiments underway.
Re: 32 bit SSL SMTP
Posted: Mon Jul 22, 2013 7:18 pm
by RichAlgeni
Here's what I found doing a search online:
The default environment for (non-CE) Windows is ASCII. If you want to use it with Unicode, you'd have to also build the DLL as a Unicode DLL (via the UNICODE_CHARS define). I'd recommend giving this a name other than cl32.dll to avoid confusion over using the incorrect DLL.
Re: 32 bit SSL SMTP
Posted: Mon Jul 22, 2013 7:35 pm
by RichAlgeni
Here is the complete zipped download, if someone with a C compiler would like to take on creating the dll's with Unicode.
http://www.rca2.com/dlls/cl342.zip
Maybe they could be named
unic_cl32.dll and
unic_cl64.dll?
Re: 32 bit SSL SMTP
Posted: Tue Jul 23, 2013 12:18 pm
by IdeasVacuum
Google no longer accepts any un-encrypted email (plain text), which is a pain - not every email needs Fort Knox security.
I had hoped that cryptlib would have Unicode versions of each command alongside the ASCII ones.
However, it seems things have changed. The lib is of course vast, what it can do for email is only a small part of the entire lib - but if you want to use cryptlib for your commercial app, you have to buy the whole lib
Even if your app is not commercial, you must have a cryptlib license:
http://www.cryptlib.com/downloads/crypt ... e-2010.pdf
Licensing and Pricing
cryptlib is distributed under a dual license that allows free, open/source use under a GPL/like license (aka the "Sleepycat"license) and closed/source use under a standard commercial license. In addition, cryptlib is often free for use in low/cost, non/open/source applications such as shareware, and for personal and research use.
NB: All cryptlib users must have a valid software license. Please contact the cryptlib sales team for further details, and a license estimate.
Sales team? Sounds like it is going to be expensive if you only want to use it for email from your app.........
Re: 32 bit SSL SMTP
Posted: Tue Jul 23, 2013 3:36 pm
by RichAlgeni
Would it be recommended to move to OpenSSL?
Re: 32 bit SSL SMTP
Posted: Tue Jul 23, 2013 4:42 pm
by IdeasVacuum
The license for OpenSSL is extremely fair.
Re: 32 bit SSL SMTP
Posted: Tue Jul 23, 2013 11:57 pm
by IdeasVacuum
So far as I can tell at the moment, openssl can be used in a similar way to PB's Network lib, so it's easy to use. However, it's huge, so a lot of work looks to be needed to separate the wheat from the chaff.
Edit: The documentation could be better!