Files
harbour-core/contrib/hbtip/tests/gmail.prg
Jean Lefebvre (Mafact) 873c60d54f 2015-01-29 23:55 UTC+0100 Jean Lefebvre (jfl/at/mafact.com)
2015-01-29 23:55 UTC+0100 Jean Lefebvre (jfl/at/mafact.com)
* contrib/hbtip/sendmail.prg
* Modified hb_sendmail(...) to allow TLS on port 587
No change in parameters
* contrib/hbtip/client.prg
+ added FUNCTION ActivateSSL(Self)
* changed all actual ref to TLS to SSL for clarity with real TLS vars
and methods
* contrib/hbtip/smtpcli.prg
+ Added METHOD StartTLS() to allow starting SSL crypting after receiving
the STARTTLS command only
+ Added METHOD DetectSecurity() to initiate Authentification methods
reading 250-xxx lines
* contrib/hbtip/tests/gmail.prg
* changed comment to explain TLS on port 587 for gmail
* changed port to 587 to allow testing
* Auto detect SSL on 465 and plain text on 587 (till STARTTLS command)
2015-01-29 23:57:12 +01:00

52 lines
1.2 KiB
Plaintext

/*
* 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