2009-08-10 02:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbtip/sessid.prg
* contrib/hbtip/cgi.prg
* contrib/hbtip/encoder.prg
* contrib/hbtip/mail.prg
* contrib/hbtip/sendmail.prg
* contrib/hbtip/httpcli.prg
* contrib/hbtip/smtpcli.prg
* contrib/hbtip/client.prg
* contrib/hbtip/ftpcli.prg
* contrib/hbtip/popcli.prg
+ Added TIP_SSL() function to return whether SSL functionality is available
or not.
% Deleted unnecessary tip.ch header inclusions.
+ Added TIPCLIENT():INETTIMEOUT() method to set / refresh timeout.
% Direct hb_inetTimeout() calls either optimized out (after ::super:open()),
or replaced by ::hb_inetTimeout() calls.
! Fixed to also accept pop3s where pops is accepted.
+ TIPCLIENTPOP() will set default port to 995 in pop3s mode.
+ TIPCLIENTSMTP() will set default port to 465 in smtps mode.
+ TIPCLIENTHTTP() will set default port to 443 in https mode.
+ Some steps towards SMTP STARTTLS authentication.
! Uncommented setting "Content-Length" in TIPMAIL:SETBODY().
gmail rejects attachment without it. It's also needed for internal
consistency as TIPMAIL:NEW() sets this data.
! HB_SENDMAIL() fixed to use HB_MEMOREAD() to read attachment.
! HB_SENDMAIL() fixed to load the attachment if it was passed
as a content/name pair array. Handling all combinations now.
* HB_SENDMAIL() changed to not exit on the first invalid attachment
specification, but simply ignore these. Feels more natural that way,
but the old behaviour can be restored if there was a reason for it
which overlooked.
* Formatting.
; TOFIX: hbtip currently has two different facilities to find out the
MIME type of a given extension: TIP_FILEMIMETYPE() and
HB_SETMIMETYPE(). First one also looks into the content while
the second one has a much more extensive extension based
detection. There is also a 3rd and separate function which
aims to detect whether a type is binary or text. This isn't
very efficient this way, unless there is some reasoning
behing current logic.
* contrib/hbtip/log.prg
! Fixed to reset internal file handle to empty value on close.
* contrib/hbssl/sslctx.c
! Added !OPENSSL_NO_STDIO guard for functions where it applies().
+ Added SSL_CTX_LOAD_VERIFY_LOCATIONS().
* config/global.cf
! Deleted two debug lines from prev commit.
This commit is contained in:
@@ -276,9 +276,6 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
$(info Harbour GNU Make: Detected shell: $(SHELL))
|
||||
$(info Harbour GNU Make: Detected shell: $(HB_SHELL))
|
||||
|
||||
CMDPREF :=
|
||||
ifneq ($(HB_SHELL),sh)
|
||||
ifneq ($(COMSPEC),)
|
||||
|
||||
@@ -445,19 +445,6 @@ HB_FUNC( SSL_CTX_SESS_TIMEOUTS )
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( SSL_CTX_SET_DEFAULT_VERIFY_PATHS )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
|
||||
if( ctx )
|
||||
hb_retni( SSL_CTX_set_default_verify_paths( ctx ) );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( SSL_CTX_NEED_TMP_RSA )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) )
|
||||
@@ -740,6 +727,40 @@ HB_FUNC( SSL_CTX_USE_PRIVATEKEY )
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( SSL_CTX_LOAD_VERIFY_LOCATIONS )
|
||||
{
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
if( hb_SSL_CTX_is( 1 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
|
||||
if( ctx )
|
||||
hb_retni( SSL_CTX_load_verify_locations( ctx, hb_parc( 2 ) /* CAfile */, hb_parc( 3 ) /* CApath */ ) );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
#else
|
||||
hb_errRT_BASE( EG_NOFUNC, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( SSL_CTX_SET_DEFAULT_VERIFY_PATHS )
|
||||
{
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
if( hb_SSL_CTX_is( 1 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
|
||||
if( ctx )
|
||||
hb_retni( SSL_CTX_set_default_verify_paths( ctx ) );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
#else
|
||||
hb_errRT_BASE( EG_NOFUNC, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
|
||||
@@ -761,7 +782,6 @@ int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY
|
||||
int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
|
||||
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
|
||||
int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx);
|
||||
int SSL_CTX_load_verify_locations(SSL_CTX *ctx, char *CAfile, char *CApath);
|
||||
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy);
|
||||
int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess);
|
||||
void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess);
|
||||
|
||||
@@ -65,8 +65,6 @@
|
||||
#include "common.ch"
|
||||
#include "fileio.ch"
|
||||
|
||||
#include "tip.ch"
|
||||
|
||||
#define CGI_IN 0
|
||||
#define CGI_OUT 1
|
||||
#define _CRLF Chr( 13 ) + Chr( 10 )
|
||||
|
||||
@@ -82,8 +82,6 @@
|
||||
#include "hbssl.ch"
|
||||
#endif
|
||||
|
||||
#include "tip.ch"
|
||||
|
||||
#define RCV_BUF_SIZE Int( ::InetRcvBufSize( ::SocketCon ) / 2 )
|
||||
#define SND_BUF_SIZE Int( ::InetSndBufSize( ::SocketCon ) / 2 )
|
||||
|
||||
@@ -160,6 +158,8 @@ CREATE CLASS tIPClient
|
||||
METHOD InetRcvBufSize( SocketCon, nSizeBuff )
|
||||
METHOD InetSndBufSize( SocketCon, nSizeBuff )
|
||||
|
||||
METHOD InetTimeOut( SocketCon, nConnTimeout )
|
||||
|
||||
PROTECTED:
|
||||
|
||||
VAR nLastError INIT 0
|
||||
@@ -201,11 +201,11 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClient
|
||||
#if defined( HAS_OPENSSL )
|
||||
IF oURL:cProto == "ftps" .OR. ;
|
||||
oURL:cProto == "https" .OR. ;
|
||||
oURL:cProto == "pops" .OR. ;
|
||||
oURL:cProto == "pop3s" .OR. oURL:cProto == "pops" .OR. ;
|
||||
oURL:cProto == "smtps"
|
||||
::EnableTLS( .T. )
|
||||
ENDIF
|
||||
cProtoAccepted += "," + "ftps,https,pops,smtps"
|
||||
cProtoAccepted += "," + "ftps,https,pop3s,pops,smtps"
|
||||
#endif
|
||||
|
||||
IF ! oURL:cProto $ cProtoAccepted
|
||||
@@ -253,9 +253,7 @@ METHOD Open( cUrl ) CLASS tIPClient
|
||||
|
||||
::SocketCon := hb_inetCreate()
|
||||
|
||||
IF ISNUMBER( ::nConnTimeout )
|
||||
hb_inetTimeout( ::SocketCon, ::nConnTimeout )
|
||||
ENDIF
|
||||
::InetTimeOut( ::SocketCon )
|
||||
|
||||
IF ! Empty( ::cProxyHost )
|
||||
cResp := ""
|
||||
@@ -768,6 +766,15 @@ METHOD InetSndBufSize( SocketCon, nSizeBuff ) CLASS tIPClient
|
||||
ENDIF
|
||||
RETURN hb_inetGetSndBufSize( SocketCon )
|
||||
|
||||
METHOD InetTimeOut( SocketCon, nConnTimeout ) CLASS tIPClient
|
||||
IF ISNUMBER( nConnTimeout )
|
||||
::nConnTimeout := nConnTimeout
|
||||
ENDIF
|
||||
IF ISNUMBER( ::nConnTimeout )
|
||||
RETURN hb_inetTimeout( SocketCon, ::nConnTimeout )
|
||||
ENDIF
|
||||
RETURN NIL
|
||||
|
||||
/* Called from another method with list of parameters and, as last parameter, return code
|
||||
of function being logged.
|
||||
Example, I want to log MyFunc( a, b, c ) which returns m,
|
||||
@@ -815,3 +822,10 @@ METHOD SetProxy( cProxyHost, nProxyPort, cProxyUser, cProxyPassword ) CLASS tIPC
|
||||
::cProxyPassword := cProxyPassword
|
||||
|
||||
RETURN Self
|
||||
|
||||
FUNCTION tip_SSL()
|
||||
#if defined( HAS_OPENSSL )
|
||||
RETURN .T.
|
||||
#else
|
||||
RETURN .F.
|
||||
#endif
|
||||
|
||||
@@ -52,21 +52,17 @@
|
||||
|
||||
/*
|
||||
Internet Messaging: http://www.ietf.org/rfc/rfc2045.txt
|
||||
|
||||
*/
|
||||
|
||||
/* 2007-04-12, Hannes Ziegler <hz AT knowlexbase.com>
|
||||
Added Function: TIp_GetEncoder()
|
||||
*/
|
||||
|
||||
|
||||
#include "hbclass.ch"
|
||||
|
||||
#include "common.ch"
|
||||
#include "fileio.ch"
|
||||
|
||||
#include "tip.ch"
|
||||
|
||||
FUNCTION TIp_GetEncoder( cModel )
|
||||
LOCAL oEncoder
|
||||
|
||||
|
||||
@@ -199,7 +199,6 @@ METHOD Open( cUrl ) CLASS tIPClientFTP
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
hb_inetTimeout( ::SocketCon, ::nConnTimeout )
|
||||
IF ::GetReply()
|
||||
::InetSendall( ::SocketCon, "USER " + ::oUrl:cUserid + ::cCRLF )
|
||||
IF ::GetReply()
|
||||
@@ -259,7 +258,7 @@ METHOD Pasv() CLASS tIPClientFTP
|
||||
|
||||
METHOD Close() CLASS tIPClientFTP
|
||||
|
||||
hb_inetTimeOut( ::SocketCon, ::nConnTimeout )
|
||||
::InetTimeOut( ::SocketCon )
|
||||
|
||||
::Quit()
|
||||
|
||||
@@ -328,7 +327,8 @@ METHOD TransferStart() CLASS tIPClientFTP
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
hb_inetTimeout( skt, ::nConnTimeout )
|
||||
::InetTimeOut( skt )
|
||||
|
||||
/* Set internal socket send buffer to 64k,
|
||||
* this should fix the speed problems some users have reported
|
||||
*/
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
#include "common.ch"
|
||||
#include "fileio.ch"
|
||||
|
||||
#include "tip.ch"
|
||||
|
||||
CREATE CLASS tIPClientHTTP FROM tIPClient
|
||||
|
||||
VAR cMethod
|
||||
@@ -104,7 +102,7 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClientHTTP
|
||||
|
||||
::super:new( oUrl, bTrace, oCredentials )
|
||||
|
||||
::nDefaultPort := 80
|
||||
::nDefaultPort := iif( ::oUrl:cProto == "https", 443, 80 )
|
||||
::nConnTimeout := 5000
|
||||
::bChunked := .F.
|
||||
|
||||
|
||||
@@ -112,9 +112,12 @@ METHOD Add( cMsg ) CLASS TIPLOG
|
||||
RETURN .F.
|
||||
|
||||
METHOD Close() CLASS TIPLOG
|
||||
LOCAL lRetVal
|
||||
|
||||
IF ! Empty( ::fhnd ) .AND. ::fhnd != F_ERROR
|
||||
RETURN FClose( ::fhnd )
|
||||
lRetVal := FClose( ::fhnd )
|
||||
::fhnd := NIL
|
||||
RETURN lRetVal
|
||||
ENDIF
|
||||
|
||||
RETURN .F.
|
||||
|
||||
@@ -140,7 +140,7 @@ METHOD New( cBody, oEncoder ) CLASS TipMail
|
||||
RETURN Self
|
||||
|
||||
METHOD SetEncoder( cEnc ) CLASS TipMail
|
||||
if hb_isString( cEnc )
|
||||
IF hb_isString( cEnc )
|
||||
::oEncoder := TIp_GetEncoder( cEnc )
|
||||
ELSE
|
||||
::oEncoder := cEnc
|
||||
@@ -151,11 +151,11 @@ METHOD SetEncoder( cEnc ) CLASS TipMail
|
||||
METHOD SetBody( cBody ) CLASS TipMail
|
||||
IF ::oEncoder != NIL
|
||||
::cBody := ::oEncoder:Encode( cBody )
|
||||
::lBodyEncoded:=.T. //GD needed to prevent an extra crlf from being appended
|
||||
::lBodyEncoded := .T. //GD needed to prevent an extra crlf from being appended
|
||||
ELSE
|
||||
::cBody := cBody
|
||||
ENDIF
|
||||
//::hHeaders[ "Content-Length" ] := hb_ntos( Len( cBody ) ) //GD -not needed
|
||||
::hHeaders[ "Content-Length" ] := hb_ntos( Len( cBody ) )
|
||||
RETURN .T.
|
||||
|
||||
METHOD GetBody() CLASS TipMail
|
||||
@@ -176,7 +176,7 @@ METHOD GetFieldPart( cPart ) CLASS TipMail
|
||||
cEnc := hb_HValueAt( ::hHeaders, nPos )
|
||||
nPos := At( ";", cEnc )
|
||||
IF nPos != 0
|
||||
cEnc := SubStr( cEnc, 1, nPos - 1)
|
||||
cEnc := SubStr( cEnc, 1, nPos - 1 )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
@@ -301,25 +301,25 @@ METHOD ToString() CLASS TipMail
|
||||
// Begin output the fields
|
||||
// Presenting them in a "well-known" order
|
||||
IF "Return-Path" $ ::hHeaders
|
||||
cRet += "Return-Path: "+::hHeaders[ "Return-Path" ] + e"\r\n"
|
||||
cRet += "Return-Path: " + ::hHeaders[ "Return-Path" ] + e"\r\n"
|
||||
ENDIF
|
||||
IF "Delivered-To" $ ::hHeaders
|
||||
cRet += "Delivered-To: "+::hHeaders[ "Delivered-To" ] + e"\r\n"
|
||||
cRet += "Delivered-To: " + ::hHeaders[ "Delivered-To" ] + e"\r\n"
|
||||
ENDIF
|
||||
FOR EACH cElem IN ::aReceived
|
||||
cRet += "Received: "+ cElem+ e"\r\n"
|
||||
cRet += "Received: " + cElem + e"\r\n"
|
||||
NEXT
|
||||
IF "Date" $ ::hHeaders
|
||||
cRet += "Date: "+::hHeaders[ "Date" ] + e"\r\n"
|
||||
cRet += "Date: " + ::hHeaders[ "Date" ] + e"\r\n"
|
||||
ENDIF
|
||||
IF "From" $ ::hHeaders
|
||||
cRet += "From: "+::hHeaders[ "From" ] + e"\r\n"
|
||||
cRet += "From: " + ::hHeaders[ "From" ] + e"\r\n"
|
||||
ENDIF
|
||||
IF "To" $ ::hHeaders
|
||||
cRet += "To: "+::hHeaders[ "To" ] + e"\r\n"
|
||||
cRet += "To: " + ::hHeaders[ "To" ] + e"\r\n"
|
||||
ENDIF
|
||||
IF "Subject" $ ::hHeaders
|
||||
cRet += "Subject: "+ ::hHeaders[ "Subject" ] + e"\r\n"
|
||||
cRet += "Subject: " + ::hHeaders[ "Subject" ] + e"\r\n"
|
||||
ENDIF
|
||||
IF Len( ::aAttachments ) > 0
|
||||
cRet += "Mime-Version:" + ::hHeaders[ "Mime-Version" ] + e"\r\n"
|
||||
@@ -327,14 +327,14 @@ METHOD ToString() CLASS TipMail
|
||||
|
||||
FOR i := 1 TO Len( ::hHeaders )
|
||||
cElem := Lower( hb_HKeyAt( ::hHeaders, i ) )
|
||||
IF !( cElem == "return-path" ) .AND.;
|
||||
!( cElem == "delivered-to" ) .AND.;
|
||||
!( cElem == "date" ) .AND.;
|
||||
!( cElem == "from" ) .AND.;
|
||||
!( cElem == "to" ) .AND.;
|
||||
!( cElem == "subject" ) .AND.;
|
||||
IF !( cElem == "return-path" ) .AND. ;
|
||||
!( cElem == "delivered-to" ) .AND. ;
|
||||
!( cElem == "date" ) .AND. ;
|
||||
!( cElem == "from" ) .AND. ;
|
||||
!( cElem == "to" ) .AND. ;
|
||||
!( cElem == "subject" ) .AND. ;
|
||||
!( cElem == "mime-version" )
|
||||
cRet += hb_HKeyAt( ::hHeaders, i ) + ": " +;
|
||||
cRet += hb_HKeyAt( ::hHeaders, i ) + ": " + ;
|
||||
hb_HValueAt( ::hHeaders, i ) + e"\r\n"
|
||||
ENDIF
|
||||
NEXT
|
||||
@@ -352,7 +352,7 @@ METHOD ToString() CLASS TipMail
|
||||
cRet += "--" + cBoundary + e"\r\n"
|
||||
cRet += "Content-Type: text/plain; charset=ISO-8859-1; format=flowed" + e"\r\n"
|
||||
cRet += "Content-Transfer-Encoding: 7bit" + e"\r\n"
|
||||
cRet += "Content-Disposition: inline" + e"\r\n"+ e"\r\n"
|
||||
cRet += "Content-Disposition: inline" + e"\r\n" + e"\r\n"
|
||||
cRet += ::cBody + e"\r\n"
|
||||
ENDIF
|
||||
ENDIF
|
||||
@@ -413,7 +413,7 @@ METHOD FromString( cMail, cBoundary, nPos ) CLASS TipMail
|
||||
nPos := nLinePos + 2
|
||||
nLinePos := hb_At( e"\r\n", cMail, nPos )
|
||||
//Prevents malformed body to affect us
|
||||
IF cBoundary != NIL .AND. hb_At( "--"+cBoundary, cMail, nPos ) == 1
|
||||
IF cBoundary != NIL .AND. hb_At( "--" + cBoundary, cMail, nPos ) == 1
|
||||
RETURN 0
|
||||
ENDIF
|
||||
ENDDO
|
||||
@@ -498,7 +498,7 @@ METHOD FromString( cMail, cBoundary, nPos ) CLASS TipMail
|
||||
::cBody := SubStr( cMail, nBodyPos, nPos - nBodyPos )
|
||||
ENDIF
|
||||
|
||||
RETURN nPos
|
||||
RETURN nPos
|
||||
|
||||
METHOD MakeBoundary() CLASS TipMail
|
||||
LOCAL cBound := "=_0" + Space( 17 )
|
||||
@@ -509,7 +509,7 @@ METHOD MakeBoundary() CLASS TipMail
|
||||
NEXT
|
||||
|
||||
cBound += "_TIP_" + DToS( Date() ) +;
|
||||
"_" + StrTran(Time(), ":" )
|
||||
"_" + StrTran( Time(), ":" )
|
||||
|
||||
RETURN cBound
|
||||
|
||||
|
||||
@@ -88,13 +88,13 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClientPOP
|
||||
LOCAL oLog
|
||||
|
||||
IF ISLOGICAL( bTrace ) .AND. bTrace
|
||||
oLog := tIPLog():New( "pop" )
|
||||
oLog := tIPLog():New( "pop3" )
|
||||
bTrace := {| cMsg | iif( PCount() > 0, oLog:Add( cMsg ), oLog:Close() ) }
|
||||
ENDIF
|
||||
|
||||
::super:New( oUrl, bTrace, oCredentials )
|
||||
|
||||
::nDefaultPort := 110
|
||||
::nDefaultPort := iif( ::oUrl:cProto == "pop3s" .OR. ::oUrl:cProto == "pops", 995, 110 )
|
||||
::nConnTimeout := 10000
|
||||
|
||||
RETURN Self
|
||||
@@ -108,7 +108,6 @@ METHOD Open( cUrl ) CLASS tIPClientPOP
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
hb_inetTimeout( ::SocketCon, ::nConnTimeout )
|
||||
IF ::GetOk()
|
||||
::InetSendall( ::SocketCon, "USER " + ::oUrl:cUserid + ::cCRLF )
|
||||
IF ::GetOK()
|
||||
@@ -136,7 +135,7 @@ METHOD Noop() CLASS tIPClientPOP
|
||||
|
||||
METHOD Close() CLASS tIPClientPOP
|
||||
|
||||
hb_inetTimeOut( ::SocketCon, ::nConnTimeout )
|
||||
::InetTimeOut( ::SocketCon )
|
||||
|
||||
::Quit()
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
LOCAL lReturn := .T.
|
||||
LOCAL lAuthLogin := .F.
|
||||
LOCAL lAuthPlain := .F.
|
||||
LOCAL lAuthTLS := .F.
|
||||
LOCAL lConnect := .T.
|
||||
LOCAL oPop
|
||||
|
||||
@@ -233,7 +234,6 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
oAttach:hHeaders[ "Content-Type" ] := cMimeText
|
||||
cBodyTemp := cBody
|
||||
cBody := MemoRead( cBodyTemp ) + Chr( 13 ) + Chr( 10 )
|
||||
|
||||
ELSE
|
||||
oMail:hHeaders[ "Content-Type" ] := "text/plain; charset=iso8851"
|
||||
ENDIF
|
||||
@@ -279,6 +279,10 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
lAuthLogin := .T.
|
||||
ELSEIF "PLAIN" $ oInMail:cReply
|
||||
lAuthPlain := .T.
|
||||
#if defined( HAS_OPENSSL )
|
||||
ELSEIF "STARTTLS" $ oInMail:cReply
|
||||
lAuthTLS := .T.
|
||||
#endif
|
||||
ENDIF
|
||||
ENDDO
|
||||
|
||||
@@ -321,12 +325,12 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
|
||||
oInmail:nConnTimeout := nTimeOut
|
||||
|
||||
IF ! oInMail:Open()
|
||||
IF ! oInMail:Open( NIL, lAuthTLS )
|
||||
oInmail:Close()
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
WHILE .T.
|
||||
DO WHILE .T.
|
||||
oInMail:GetOk()
|
||||
IF oInMail:cReply == NIL
|
||||
EXIT
|
||||
@@ -344,15 +348,27 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
|
||||
IF ISCHARACTER( aThisFile )
|
||||
cFile := aThisFile
|
||||
cData := MemoRead( cFile ) + Chr( 13 ) + Chr( 10 )
|
||||
cData := hb_MemoRead( cFile )
|
||||
ELSEIF ISARRAY( aThisFile ) .AND. Len( aThisFile ) >= 2
|
||||
cFile := aThisFile[ 1 ]
|
||||
cData := aThisFile[ 2 ] + Chr( 13 ) + Chr( 10 )
|
||||
IF ISCHARACTER( aThisFile[ 2 ] )
|
||||
cData := aThisFile[ 2 ]
|
||||
IF ! ISCHARACTER( cFile )
|
||||
cFile := "unnamed"
|
||||
ENDIF
|
||||
ELSE
|
||||
IF ! ISCHARACTER( cFile )
|
||||
LOOP /* No filename and no content. */
|
||||
ELSE
|
||||
cData := hb_MemoRead( cFile )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ELSE
|
||||
lReturn := .F.
|
||||
EXIT
|
||||
LOOP
|
||||
ENDIF
|
||||
|
||||
cData += Chr( 13 ) + Chr( 10 )
|
||||
|
||||
oAttach := TipMail():New()
|
||||
|
||||
hb_FNameSplit( cFile,, @cFname, @cFext )
|
||||
@@ -383,7 +399,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
( cFile LIKE ".+\.(push|wan|waf||afl|mpeg|mpg|mpe|qt|mov)" ) .OR. ;
|
||||
( cFile LIKE ".+\.(viv|vivo|asf|asx|avi|movie|vgm|vgx)" ) .OR. ;
|
||||
( cFile LIKE ".+\.(xdr|vgp|vts|vtts|3dmf|3dm|qd3d|qd3)" ) .OR. ;
|
||||
( cFile LIKE ".+\.(svr|wrl|wrz|vrt)" ) .OR. Empty(cFExt)
|
||||
( cFile LIKE ".+\.(svr|wrl|wrz|vrt)" ) .OR. Empty( cFExt )
|
||||
oAttach:SetEncoder( "base64" )
|
||||
ELSE
|
||||
oAttach:SetEncoder( "7-bit" )
|
||||
@@ -401,7 +417,6 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
oAttach:hHeaders[ "Content-Disposition" ] := "attachment; filename=" + cFname + cFext
|
||||
oAttach:SetBody( cData )
|
||||
oMail:Attach( oAttach )
|
||||
|
||||
NEXT
|
||||
|
||||
IF lRead
|
||||
@@ -426,93 +441,93 @@ FUNCTION hb_SetMimeType( cFile, cFname, cFext )
|
||||
cFile := Lower( cFile )
|
||||
|
||||
DO CASE
|
||||
CASE ( cFile LIKE ".+\.vbd" ); RETURN "application/activexdocument="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(asn|asz|asd)" ); RETURN "application/astound="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vbd" ); RETURN "application/activexdocument=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(asn|asz|asd)" ); RETURN "application/astound=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pqi" ); RETURN "application/cprplayer=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tsp" ); RETURN "application/dsptype="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.exe" ); RETURN "application/exe="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(sml|ofml)" ); RETURN "application/fml="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pfr" ); RETURN "application/font-tdpfr=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.frl" ); RETURN "application/freeloader=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tsp" ); RETURN "application/dsptype=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.exe" ); RETURN "application/exe=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(sml|ofml)" ); RETURN "application/fml=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pfr" ); RETURN "application/font-tdpfr=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.frl" ); RETURN "application/freeloader=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.spl" ); RETURN "application/futuresplash =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.gz" ); RETURN "application/gzip =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.stk" ); RETURN "application/hstu =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ips" ); RETURN "application/ips="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ips" ); RETURN "application/ips=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ptlk" ); RETURN "application/listenup =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.hqx" ); RETURN "application/mac-binhex40 =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mbd" ); RETURN "application/mbedlet="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mfp" ); RETURN "application/mirage=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mbd" ); RETURN "application/mbedlet=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mfp" ); RETURN "application/mirage=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(pot|pps|ppt|ppz)" ); RETURN "application/mspowerpoint =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.doc" ); RETURN "application/msword=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.n2p" ); RETURN "application/n2p="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.doc" ); RETURN "application/msword=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.n2p" ); RETURN "application/n2p=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(bin|class|lha|lzh|lzx|dbf)" ); RETURN "application/octet-stream =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.oda" ); RETURN "application/oda="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.oda" ); RETURN "application/oda=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.axs" ); RETURN "application/olescript=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.zpa" ); RETURN "application/pcphoto="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pdf" ); RETURN "application/pdf="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(ai|eps|ps)" ); RETURN "application/postscript=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.zpa" ); RETURN "application/pcphoto=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pdf" ); RETURN "application/pdf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(ai|eps|ps)" ); RETURN "application/postscript=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.shw" ); RETURN "application/presentations=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.qrt" ); RETURN "application/quest=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rtc" ); RETURN "application/rtc="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rtf" ); RETURN "application/rtf="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.smp" ); RETURN "application/studiom="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dst" ); RETURN "application/tajima=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.talk" ); RETURN "application/talker=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rtc" ); RETURN "application/rtc=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rtf" ); RETURN "application/rtf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.smp" ); RETURN "application/studiom=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dst" ); RETURN "application/tajima=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.talk" ); RETURN "application/talker=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tbk" ); RETURN "application/toolbook =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vmd" ); RETURN "application/vocaltec-media-desc="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vmf" ); RETURN "application/vocaltec-media-file="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vmd" ); RETURN "application/vocaltec-media-desc=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vmf" ); RETURN "application/vocaltec-media-file=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wri" ); RETURN "application/write=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wid" ); RETURN "application/x-DemoShield =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rrf" ); RETURN "application/x-InstallFromTheWeb="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wis" ); RETURN "application/x-InstallShield="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rrf" ); RETURN "application/x-InstallFromTheWeb=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wis" ); RETURN "application/x-InstallShield=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ins" ); RETURN "application/x-NET-Install=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tmv" ); RETURN "application/x-Parable-Thing="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tmv" ); RETURN "application/x-Parable-Thing=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.arj" ); RETURN "application/x-arj=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.asp" ); RETURN "application/x-asap=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.asp" ); RETURN "application/x-asap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.aab" ); RETURN "application/x-authorware-bin =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(aam|aas)" ); RETURN "application/x-authorware-map =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.bcpio" ); RETURN "application/x-bcpio="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.bcpio" ); RETURN "application/x-bcpio=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vcd" ); RETURN "application/x-cdlink =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.chat" ); RETURN "application/x-chat=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.chat" ); RETURN "application/x-chat=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.cnc" ); RETURN "application/x-cnc=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(coda|page)" ); RETURN "application/x-coda=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.z" ); RETURN "application/x-compress=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.con" ); RETURN "application/x-connector="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.cpio" ); RETURN "application/x-cpio=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pqf" ); RETURN "application/x-cprplayer="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(coda|page)" ); RETURN "application/x-coda=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.z" ); RETURN "application/x-compress=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.con" ); RETURN "application/x-connector=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.cpio" ); RETURN "application/x-cpio=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pqf" ); RETURN "application/x-cprplayer=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.csh" ); RETURN "application/x-csh=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(cu|csm)" ); RETURN "application/x-cu-seeme=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(dcr|dir|dxr|swa)" ); RETURN "application/x-director=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(cu|csm)" ); RETURN "application/x-cu-seeme=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(dcr|dir|dxr|swa)" ); RETURN "application/x-director=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dvi" ); RETURN "application/x-dvi=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.evy" ); RETURN "application/x-envoy="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ebk" ); RETURN "application/x-expandedbook=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.gtar" ); RETURN "application/x-gtar=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.evy" ); RETURN "application/x-envoy=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ebk" ); RETURN "application/x-expandedbook=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.gtar" ); RETURN "application/x-gtar=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.hdf" ); RETURN "application/x-hdf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.map" ); RETURN "application/x-httpd-imap =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.phtml" ); RETURN "application/x-httpd-php="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.phtml" ); RETURN "application/x-httpd-php=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.php3" ); RETURN "application/x-httpd-php3 =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ica" ); RETURN "application/x-ica=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ipx" ); RETURN "application/x-ipix=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ips" ); RETURN "application/x-ipscript=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ipx" ); RETURN "application/x-ipix=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ips" ); RETURN "application/x-ipscript=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.js" ); RETURN "application/x-javascript =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.latex" ); RETURN "application/x-latex="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.bin" ); RETURN "application/x-macbinary="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.latex" ); RETURN "application/x-latex=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.bin" ); RETURN "application/x-macbinary=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mif" ); RETURN "application/x-mif=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(mpl|mpire)" ); RETURN "application/x-mpire="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(mpl|mpire)" ); RETURN "application/x-mpire=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.adr" ); RETURN "application/x-msaddr =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wlt" ); RETURN "application/x-mswallet=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wlt" ); RETURN "application/x-mswallet=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(nc|cdf)" ); RETURN "application/x-netcdf =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.npx" ); RETURN "application/x-netfpx =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.nsc" ); RETURN "application/x-nschat =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pgp" ); RETURN "application/x-pgp-plugin =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.css" ); RETURN "application/x-pointplus="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.css" ); RETURN "application/x-pointplus=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sh" ); RETURN "application/x-sh =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.shar" ); RETURN "application/x-shar=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.shar" ); RETURN "application/x-shar=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.swf" ); RETURN "application/x-shockwave-flash=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.spr" ); RETURN "application/x-sprite =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sprite" ); RETURN "application/x-sprite =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sit" ); RETURN "application/x-stuffit=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sca" ); RETURN "application/x-supercard="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sca" ); RETURN "application/x-supercard=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sv4cpio" ); RETURN "application/x-sv4cpio=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.sv4crc" ); RETURN "application/x-sv4crc =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tar" ); RETURN "application/x-tar=" + cFname + cFext
|
||||
@@ -520,93 +535,93 @@ FUNCTION hb_SetMimeType( cFile, cFname, cFext )
|
||||
CASE ( cFile LIKE ".+\.tex" ); RETURN "application/x-tex=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(texinfo|texi)" ); RETURN "application/x-texinfo=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tlk" ); RETURN "application/x-tlk=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(t|tr|roff)" ); RETURN "application/x-troff="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.man" ); RETURN "application/x-troff-man="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.me" ); RETURN "application/x-troff-me=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ms" ); RETURN "application/x-troff-ms=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.alt" ); RETURN "application/x-up-alert=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(t|tr|roff)" ); RETURN "application/x-troff=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.man" ); RETURN "application/x-troff-man=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.me" ); RETURN "application/x-troff-me=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ms" ); RETURN "application/x-troff-ms=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.alt" ); RETURN "application/x-up-alert=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.che" ); RETURN "application/x-up-cacheop =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ustar" ); RETURN "application/x-ustar="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ustar" ); RETURN "application/x-ustar=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.src" ); RETURN "application/x-wais-source=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xls" ); RETURN "application/xls="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xlt" ); RETURN "application/xlt="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.zip" ); RETURN "application/zip="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(au|snd)" ); RETURN "audio/basic="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xls" ); RETURN "application/xls=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xlt" ); RETURN "application/xlt=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.zip" ); RETURN "application/zip=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(au|snd)" ); RETURN "audio/basic=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.es" ); RETURN "audio/echospeech =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(gsm|gsd)" ); RETURN "audio/gsm=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rmf" ); RETURN "audio/rmf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tsi" ); RETURN "audio/tsplayer=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tsi" ); RETURN "audio/tsplayer=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vox" ); RETURN "audio/voxware=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wtx" ); RETURN "audio/wtx=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(aif|aiff|aifc)" ); RETURN "audio/x-aiff =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(cht|dus)" ); RETURN "audio/x-dspeech="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(cht|dus)" ); RETURN "audio/x-dspeech=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(mid|midi)" ); RETURN "audio/x-midi =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mp3" ); RETURN "audio/x-mpeg =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mp2" ); RETURN "audio/x-mpeg =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.m3u" ); RETURN "audio/x-mpegurl="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.m3u" ); RETURN "audio/x-mpegurl=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(ram|ra)" ); RETURN "audio/x-pn-realaudio =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rpm" ); RETURN "audio/x-pn-realaudio-plugin="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rpm" ); RETURN "audio/x-pn-realaudio-plugin=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.stream" ); RETURN "audio/x-qt-stream=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rmf" ); RETURN "audio/x-rmf="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(vqf|vql)" ); RETURN "audio/x-twinvq=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rmf" ); RETURN "audio/x-rmf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(vqf|vql)" ); RETURN "audio/x-twinvq=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vqe" ); RETURN "audio/x-twinvq-plugin=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wav" ); RETURN "audio/x-wav="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wtx" ); RETURN "audio/x-wtx="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mol" ); RETURN "chemical/x-mdl-molfile=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pdb" ); RETURN "chemical/x-pdb=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wav" ); RETURN "audio/x-wav=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wtx" ); RETURN "audio/x-wtx=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mol" ); RETURN "chemical/x-mdl-molfile=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pdb" ); RETURN "chemical/x-pdb=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dwf" ); RETURN "drawing/x-dwf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ivr" ); RETURN "i-world/i-vrml=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ivr" ); RETURN "i-world/i-vrml=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.cod" ); RETURN "image/cis-cod=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.cpi" ); RETURN "image/cpi=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.fif" ); RETURN "image/fif=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.gif" ); RETURN "image/gif=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ief" ); RETURN "image/ief=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(jpeg|jpg|jpe)" ); RETURN "image/jpeg=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(jpeg|jpg|jpe)" ); RETURN "image/jpeg=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rip" ); RETURN "image/rip=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.svh" ); RETURN "image/svh=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(tiff|tif)" ); RETURN "image/tiff=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mcf" ); RETURN "image/vasa=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(tiff|tif)" ); RETURN "image/tiff=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.mcf" ); RETURN "image/vasa=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(svf|dwg|dxf)" ); RETURN "image/vnd=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.wi" ); RETURN "image/wavelet=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ras" ); RETURN "image/x-cmu-raster=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.etf" ); RETURN "image/x-etf="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.fpx" ); RETURN "image/x-fpx="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ras" ); RETURN "image/x-cmu-raster=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.etf" ); RETURN "image/x-etf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.fpx" ); RETURN "image/x-fpx=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(fh5|fh4|fhc)" ); RETURN "image/x-freehand =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dsf" ); RETURN "image/x-mgx-dsf="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pnm" ); RETURN "image/x-portable-anymap="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pbm" ); RETURN "image/x-portable-bitmap="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dsf" ); RETURN "image/x-mgx-dsf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pnm" ); RETURN "image/x-portable-anymap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pbm" ); RETURN "image/x-portable-bitmap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pgm" ); RETURN "image/x-portable-graymap =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ppm" ); RETURN "image/x-portable-pixmap="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rgb" ); RETURN "image/x-rgb="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xbm" ); RETURN "image/x-xbitmap="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xpm" ); RETURN "image/x-xpixmap="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xwd" ); RETURN "image/x-xwindowdump="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dig" ); RETURN "multipart/mixed="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ppm" ); RETURN "image/x-portable-pixmap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rgb" ); RETURN "image/x-rgb=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xbm" ); RETURN "image/x-xbitmap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xpm" ); RETURN "image/x-xpixmap=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.xwd" ); RETURN "image/x-xwindowdump=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.dig" ); RETURN "multipart/mixed=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.push" ); RETURN "multipart/x-mixed-replace=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(wan|waf)" ); RETURN "plugin/wanimate="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(wan|waf)" ); RETURN "plugin/wanimate=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.ccs" ); RETURN "text/ccs =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(htm|html)" ); RETURN "text/html=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pgr" ); RETURN "text/parsnegar-document="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.txt" ); RETURN "text/plain=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.pgr" ); RETURN "text/parsnegar-document=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.txt" ); RETURN "text/plain=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.rtx" ); RETURN "text/richtext=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.tsv" ); RETURN "text/tab-separated-values=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.hdml" ); RETURN "text/x-hdml="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.hdml" ); RETURN "text/x-hdml=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.etx" ); RETURN "text/x-setext=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(talk|spc)" ); RETURN "text/x-speech=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.afl" ); RETURN "video/animaflex="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(mpeg|mpg|mpe)" ); RETURN "video/mpeg=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(qt|mov)" ); RETURN "video/quicktime="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(viv|vivo)" ); RETURN "video/vnd.vivo=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(asf|asx)" ); RETURN "video/x-ms-asf=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.avi" ); RETURN "video/x-msvideo="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.afl" ); RETURN "video/animaflex=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(mpeg|mpg|mpe)" ); RETURN "video/mpeg=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(qt|mov)" ); RETURN "video/quicktime=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(viv|vivo)" ); RETURN "video/vnd.vivo=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(asf|asx)" ); RETURN "video/x-ms-asf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.avi" ); RETURN "video/x-msvideo=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.movie" ); RETURN "video/x-sgi-movie=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(vgm|vgx|xdr)" ); RETURN "video/x-videogram=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vgp" ); RETURN "video/x-videogram-plugin =" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vts" ); RETURN "workbook/formulaone="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vtts" ); RETURN "workbook/formulaone="+cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(3dmf|3dm|qd3d|qd3)" ); RETURN "x-world/x-3dmf=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vts" ); RETURN "workbook/formulaone=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vtts" ); RETURN "workbook/formulaone=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(3dmf|3dm|qd3d|qd3)" ); RETURN "x-world/x-3dmf=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.svr" ); RETURN "x-world/x-svr=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(wrl|wrz)" ); RETURN "x-world/x-vrml=" +cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.(wrl|wrz)" ); RETURN "x-world/x-vrml=" + cFname + cFext
|
||||
CASE ( cFile LIKE ".+\.vrt" ); RETURN "x-world/x-vrt=" + cFname + cFext
|
||||
ENDCASE
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tip.ch"
|
||||
#include "common.ch"
|
||||
|
||||
#define SID_LENGTH 25
|
||||
|
||||
@@ -98,7 +98,7 @@ METHOD New( oUrl, bTrace, oCredentials ) CLASS tIPClientSMTP
|
||||
|
||||
::super:New( oUrl, bTrace, oCredentials )
|
||||
|
||||
::nDefaultPort := 25
|
||||
::nDefaultPort := iif( ::oUrl:cProto == "smtps", 465, 25 )
|
||||
::nConnTimeout := 5000
|
||||
::nAccessMode := TIP_WO // a write only
|
||||
|
||||
@@ -110,8 +110,6 @@ METHOD Open( cUrl, lTLS ) CLASS tIPClientSMTP
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
hb_inetTimeout( ::SocketCon, ::nConnTimeout )
|
||||
|
||||
DEFAULT lTLS TO .F.
|
||||
|
||||
IF lTLS
|
||||
@@ -131,8 +129,6 @@ METHOD OpenSecure( cUrl, lTLS ) CLASS tIPClientSMTP
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
hb_inetTimeout( ::SocketCon, ::nConnTimeout )
|
||||
|
||||
DEFAULT lTLS TO .F.
|
||||
|
||||
IF lTLS
|
||||
@@ -156,7 +152,7 @@ METHOD GetOk() CLASS tIPClientSMTP
|
||||
RETURN .T.
|
||||
|
||||
METHOD Close() CLASS tIPClientSMTP
|
||||
hb_inetTimeOut( ::SocketCon, ::nConnTimeout )
|
||||
::InetTimeOut( ::SocketCon )
|
||||
::Quit()
|
||||
RETURN ::super:Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user