HB_Sendmail with Gmail and other SMTP

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

HB_Sendmail with Gmail and other SMTP

Post by danielmaximiliano »

Hi :

Look and Review : http://www.arclab.com/products/amlc/lis ... -list.html
Carlos Reis wrote:Hello Daniel
the user and password that I used in the program was just an example obviously does not correspond to reality.
could still have further simplified the example of routine because the aim was to hb_SendMail function ()
that it works well in version 3.0.35 HMG but does not work in version 3.0.46 HMG
down I enclose a version of the routine further simplified only to test the sending of e-mail now with real user and password
2012-01-09 22:20 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbtip/sendmail.prg
* contrib/hbtip/smtpcli.prg
! After a conversation with Antonio Maniero (also subscriber of the
dev-list), we detected some trouble with hb_sendmail() under some
conditions:
EXIM servers refuse the HELO/EHLO greeting that doesn't conform to
RFC2821, so when one try to autenticate with username containing an @
or any other character that is not allowed in FQDNs, the server
refuses to proceed. Many SMTP servers, (EG: Google ones) are more
tolerant, so I believe that this helped the problem gets unnoticed.
The patch introduces a new parameter, preserving backward
compatibility and at the same time fixing the @ problem, even in
unmodified code that doesn't provide the extra parameter (as we
removed the cUser from the HELO string, that is causing trouble with
EXIM. Anyway, these strings would be accepted only by tolerant
servers, so the correct one should cause no problem at all).
; Patch and description by Carlos Bacco. Thank you.
Code Work :

Code: Select all

/*
 * HMG - Harbour Win32 GUI library Demo
 *
 * Copyright 2002 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"

#require "hbssl"
#require "hbtip"

REQUEST __HBEXTERN__HBSSL__

#include "simpleio.ch"

Function Main

    IF ! tip_SSL()
      ? "Error: Requires SSL support"
      RETURN
   ENDIF
   
cTO   := 'carlos.reis@canas.pt'
cCorpo    := 'Serve o presente e-mail para informar de que se encontra em armazem  o seguinte material : ' 
cAssunto  := 'Aviso de chegada de material'
cFrom     := "pedro.silva256@gmail.com"            
cPassword := "pedro256"        

 MsgInfo( iif(hb_SendMail(  "smtp.gmail.com",  465, ;
      cFrom, ;
      cTo, ;
      NIL /* CC */, ;
      {} /* BCC */, ;
      cCorpo, ;
      cAssunto, ;
      NIL /* attachment */, ;
      cFrom, ;
      cPassword, ;
      "", ;
      NIL /* nPriority */, ;
      NIL /* lRead */, ;
      .T. /* lTrace */, ;
      .F., ;
      NIL /* lNoAuth */, ;
      NIL /* nTimeOut */, ;
      NIL /* cReplyTo */, ;
      .T. ), "Successfully", "Unsuccessfully"), "Result" )

Return Nil
Administrador Cwindowssystem32cmd.exe - call  chmg.3.0.46build.jpg
Administrador Cwindowssystem32cmd.exe - call chmg.3.0.46build.jpg (63.99 KiB) Viewed 4278 times
I hope that works
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
User avatar
Carlos Reis
Posts: 16
Joined: Sat Oct 09, 2010 3:31 pm
Location: Portugal

Re: HB_Sendmail with Gmail and other SMTP

Post by Carlos Reis »

Hello Daniel !
Thank you very much for your attention to my problem.
I already tested the routine according to your post above.
But it gives me an error of no file ssleay32.dll as you can see in the print below.
The question is: Do I have to install any library more for this program work?
Attachments
envio1.jpg
envio1.jpg (203.72 KiB) Viewed 4249 times
Best Regards
Carlos Reis, Portugal
39º 46' 47" N
08º 55' 45 W
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

Re: HB_Sendmail with Gmail and other SMTP

Post by danielmaximiliano »

Carlos Reis wrote:Hello Daniel !
Thank you very much for your attention to my problem.
I already tested the routine according to your post above.
But it gives me an error of no file ssleay32.dll as you can see in the print below.
The question is: Do I have to install any library more for this program work?
try installing Openssl 1.0.1c Light or complete
x86 or x64 choose from the list.
Remember that you have installed in c: \ openssl, this will install the required dll in your system

http://slproweb.com/products/Win32OpenSSL.html
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
User avatar
Carlos Reis
Posts: 16
Joined: Sat Oct 09, 2010 3:31 pm
Location: Portugal

Re: HB_Sendmail with Gmail and other SMTP

Post by Carlos Reis »

danielmaximiliano wrote:
Carlos Reis wrote:Hello Daniel !
Thank you very much for your attention to my problem.
I already tested the routine according to your post above.
But it gives me an error of no file ssleay32.dll as you can see in the print below.
The question is: Do I have to install any library more for this program work?
try installing Openssl 1.0.1c Light or complete
x86 or x64 choose from the list.
Remember that you have installed in c: \ openssl, this will install the required dll in your system

http://slproweb.com/products/Win32OpenSSL.html
Hi Daniel
Thanks a lot !
I installed the oppenssl and it works !!
Best Regards
Carlos Reis, Portugal
39º 46' 47" N
08º 55' 45 W
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

Re: HB_Sendmail with Gmail and other SMTP

Post by danielmaximiliano »

Carlos Reis wrote: Hi Daniel
Thanks a lot !
I installed the oppenssl and it works !!
Hi Carlos Reis
I am delighted that work has two options for sending email from our HMG. HB_Sendmail and TipMail.
I am now preparing to TipMail inclusion of files as attachments.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
Post Reply