SendMail

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
WimS
Posts: 5
Joined: Fri Feb 14, 2014 8:47 pm
Location: The Netherlands
Contact:

SendMail

Post by WimS »

Hello wizzards of Harbour,

I had to reinstall the whole Harbour/MiniGui environment, because my hardware supplier cleared my harddisk.
Since then I can't find the function HB_SendMail.
I tried to include many files, like #include <hfcl.ch>, but HB_SendMail seems to be dissapeared.

I the new set of Sample Applications I found the nice program SendMail.prg by Lopez, Filatov and Martinez.
I'm thinking of taking out de essential mail function, so that it can be integrated in other programs like HB_Sendmail.

Is this a good idea or am I missing some information?
If it's a good idea, I would like to share the result.

Please reply and thanks in advance,

WimS
Loosdrecht-Netherlands
User avatar
gfilatov
Posts: 1067
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: SendMail

Post by gfilatov »

WimS wrote:Hello wizzards of Harbour,

I had to reinstall the whole Harbour/MiniGui environment, because my hardware supplier cleared my harddisk.
Since then I can't find the function HB_SendMail.
I tried to include many files, like #include <hfcl.ch>, but HB_SendMail seems to be dissapeared.

I the new set of Sample Applications I found the nice program SendMail.prg by Lopez, Filatov and Martinez.
I'm thinking of taking out de essential mail function, so that it can be integrated in other programs like HB_Sendmail.

Is this a good idea or am I missing some information?
If it's a good idea, I would like to share the result.

Please reply and thanks in advance,

WimS
Loosdrecht-Netherlands
Hello,

The function HB_SendMail() is Harbour related and it's placed in the HBTIP contrib library.

Please take a look for the following sample of using for GMAIL server from the Harbour distribution:

Code: Select all

/*
 * Copyright 2009 Viktor Szakats (vszakats.net/harbour)
 * www - http://harbour-project.org
 *
 * Gmail work with ssl on port 465 and with tls on port 587
 * tls mode is fully automatic and require that ssl must be disabled at first (We will activate it on request after STARTTLS command)
 */

#require "hbssl"
#require "hbtip"

REQUEST __HBEXTERN__HBSSL__

#include "simpleio.ch"

PROCEDURE Main( cFrom, cPassword, cTo, cPort)

   IF ! tip_SSL()
      ? "Error: Requires SSL support"
      RETURN
   ENDIF

   hb_default( @cFrom    , "<myname@gmail.com>" )
   hb_default( @cPassword, "<mypassword>" )
   hb_default( @cTo      , "addressee@domain.com" )
   hb_default( @cPort    , "465" )

   ? hb_SendMail( ;
      "smtp.gmail.com", ;
      Val(cPort), ;
      cFrom, ;
      cTo, ;
      NIL /* CC */, ;
      {} /* BCC */, ;
      "test: body", ;
      "test: port "+cPort, ;
      NIL /* attachment */, ;
      cFrom, ;
      cPassword, ;
      "", ;
      NIL /* nPriority */, ;
      NIL /* lRead */, ;
      .T. /* lTrace */, ;
      .F., ;
      NIL /* lNoAuth */, ;
      NIL /* nTimeOut */, ;
      NIL /* cReplyTo */, ;
      iif(cPort=="465",.T.,.F.) /* lSSL */  )

   RETURN
 
Run via command:
c:\hb32\bin\hbmk2 -lhbtip -lhbssl -llibeay32 -lssleay32 -env:HB_TIP_OPENSSL=yes gmail.prg
Hope that useful :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
WimS
Posts: 5
Joined: Fri Feb 14, 2014 8:47 pm
Location: The Netherlands
Contact:

Re: SendMail

Post by WimS »

Dear mr Filatov,
Thank you very much. Your email functions are super.
Also thanks to Mr Serge Girard. He helped me out of troubles:
I had installed HMGExtended Harbour MiniGui
Now the official HMG (download on top of this page) is installed, everything works flawlessly again.
WimS :D
Loosdrecht-Netherlands
Post Reply