Files
harbour-core/contrib/hbtip/tests/gmail.prg
Viktor Szakats 58faf91453 2016-01-14 19:17 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
* *
    % remove brandings and homepage [1] from copyright header. Pass 1 - using script.
      [1] nobody has access to it anymore AFAIK - and it's also just
          a redirect since long
    ! update url in copyright header
    ; this should make the diff between 3.4 and 3.2 easier to manage
2016-01-14 19:18:17 +01:00

51 lines
1.1 KiB
Plaintext

/*
* Copyright 2009 Viktor Szakats (vszakats.net/harbour)
*
* 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