Page 1 of 4

hb_SendMail / tip_MailSend and CDO

Posted: Thu Dec 08, 2016 11:14 pm
by Pablo César
This is a step-by-step guide on how to use hb_SendMail and tip_MailSend.

Both functions require two libraries: hbtip and hbssl that are already in the HMG Harbour lib folder.
These need to be included in your project .hbc file.

Also need 2 external libraries that are named after files: libeay32.dll and ssleay32.dll. They also need to be included in your project .hbc file.
These libraries are available for use in the HMG 3.4.3 release so you do not have to download them again.

But in case you want to use a later version of HMG and with changes to the functions in Harbour.
You can download it from: http://slproweb.com/products/Win32OpenSSL.html

If you want to download to use HMG in 64bit, choose the appropriate file.
In this version is available as I said earlier for the HMG version 3.4.3 in 32bits and was downloaded as indicated in the figure below:
Screen30.png
Screen30.png (104.83 KiB) Viewed 8148 times
Please note that I have not downloaded the first one because it is a more current version and is for the modified functions of Harbour (Viktor version, not the one we use).

Libraries should be included in the hbc file of your project as follows:
libs=hbtip
libs=hbssl
libs=libeay32
libs=ssleay32

You can edit the hbc file or put it in the IDE as follows:
Screen27.png
Screen27.png (7.14 KiB) Viewed 8245 times
After you download the SSL installation package, you install it in a folder on your computer as shown in the sequence of figures below:
Screen29.png
Screen29.png (121.03 KiB) Viewed 8245 times
The installation will occur (if you do not rename) normally in the folder: OpenSSL-Win32, there are the two dll files that need to be copied into the folder of your project.

Now just compile, either through the IDE or the command line with Build.bat

hb_SendMail / tip_MailSend and CDO

Posted: Thu Dec 08, 2016 11:19 pm
by Pablo César
The message above do not supports more attached files. By this reason I am doing here at this other message.
hb_sendmail.rar
Source Files + Libs
(589.75 KiB) Downloaded 465 times
tip_MailSend.rar
Source Files + Libs
(580.34 KiB) Downloaded 436 times
tip_MailSend functions and subfunctions are copied from Harbour core of Viktor version.

My thanks to Daniel Maximiliano for helping me to understand the use of hb_sendmail and to all those who helped with tips. I hope I have gathered everything here.

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 1:12 am
by EduardoLuis
Hi Pablo:
First thanks forma share.
Second: true didáctica explanación.
Eduardo

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 2:47 am
by Rathinagiri
Really useful to everyone. Thanks a lot Pablo.

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 4:12 am
by bpd2000
Thank for tip and guidance

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 6:40 am
by mol
Thank you!
Do we need to install SSL installation package?
Whether it will be sufficient to copy the files libeay.dll and ssleay.dll to project folder?

hb_SendMail / tip_MailSend and CDO

Posted: Fri Dec 09, 2016 9:45 am
by Pablo César
Thank you for your interest friends, It's a pleasure to attend in this more common need.

That's right Marek, you do not have to install anything. Unless there is some change in the hb_SendMail functions of Harbour (in the future). This may occur as Viktor has adapted the newest library (Win32/64 OpenSSL v.1.1) with encryption in the SSL libraries. We are using Win32/64 OpenSSL v.1.0, its names are different now. Probably in our Harbour version will changes. For now, I think can be adapted it too for the newest SSL version (I need to make some tests, I don't know yet).

Just have these two DLLs (libeay32.dll and ssleay32.dll) in the current application folder and specify the four libraries in the hbc file to be compiled. The rest of the two other libraries (hbtip and hbssl), the Harbour, have been available for a long time.

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 10:16 am
by serge_girard
Thanks a lot Pablo, really usefull because I use it often!

Serge

Re: hb_SendMail / tip_MailSend

Posted: Fri Dec 09, 2016 11:33 am
by mol
Both dll's are in my project home directory, I also copied them to hmg\lib folder and harbour\lib\win\mingw directory and still I got linker error

Code: Select all

d:/hmg343/mingw/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibeay
d:/hmg343/mingw/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lssleay
collect2.exe: error: ld returned 1 exit status
hbmk2[FAKTURY]: Error: Running linker. 1

Compiling error by Marek

Posted: Fri Dec 09, 2016 11:50 am
by Pablo César
mol wrote:I also copied them to hmg\lib folder and harbour\lib\win\mingw directory and still I got linker error
Sorry to say but this is not a good practice. I never told you to copy any lib in your HMG. Even it is not good to mix versions, either of Harbour or HMG.

I don't know if is this your case but anyway I can say that I forgot to highlight that when compiling in 64bit SSL libraries should also be 64bit.

This is already mentioned on the external SSL library site itself.
(See the first figure posted in this topic. I'm mentioning it's for 32bit.)