32 bit SSL SMTP

Windows specific forum
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

Can you trap out where in the code the error is coming from?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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. :?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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.......
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post by IdeasVacuum »

....so, having trouble getting it to work with unicode - is it the case that the cryptlib32.dll does not accept unicode strings?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

Can you use ascii for everything but the body of the email, then switch to unicode? Not sure if that's possible.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

Or is it possible that unicode is just used as an attachment???
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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 :mrgreen:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post 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.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post 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?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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.........
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

Would it be recommended to move to OpenSSL?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post by IdeasVacuum »

The license for OpenSSL is extremely fair.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: 32 bit SSL SMTP

Post 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!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply