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
Code Work :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: 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