2009-10-12 18:42 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbtip/sendmail.prg
! Fixed wrongly referring to 7-bit encoding.
! Fixed some more hardcoded charsets.
+ Added support for user-selectable encoding.
; TOFIX: Still doesn't work for some reason.
* contrib/hbtip/encqp.prg
* contrib/hbtip/mail.prg
* Formatting.
This commit is contained in:
@@ -17,6 +17,17 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-10-12 18:42 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbtip/sendmail.prg
|
||||
! Fixed wrongly referring to 7-bit encoding.
|
||||
! Fixed some more hardcoded charsets.
|
||||
+ Added support for user-selectable encoding.
|
||||
; TOFIX: Still doesn't work for some reason.
|
||||
|
||||
* contrib/hbtip/encqp.prg
|
||||
* contrib/hbtip/mail.prg
|
||||
* Formatting.
|
||||
|
||||
2009-10-12 18:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbtip/encqp.prg
|
||||
+ Implemented quoted-printable encoder/decoder.
|
||||
|
||||
@@ -59,7 +59,7 @@ CREATE CLASS TIPEncoderQP FROM TIPEncoder
|
||||
ENDCLASS
|
||||
|
||||
METHOD New() CLASS TIPEncoderQP
|
||||
::cName := "Quoted-Printable"
|
||||
::cName := "quoted-printable"
|
||||
RETURN Self
|
||||
|
||||
METHOD Encode( cData ) CLASS TIPEncoderQP
|
||||
|
||||
@@ -68,7 +68,7 @@ CREATE CLASS TipMail
|
||||
// received fields may be more than once.
|
||||
VAR aReceived INIT {}
|
||||
|
||||
METHOD New(cBody, oEncoder ) Constructor
|
||||
METHOD New( cBody, oEncoder ) Constructor
|
||||
METHOD SetBody( cBody )
|
||||
METHOD GetBody()
|
||||
METHOD GetRawBody() INLINE ::cBody
|
||||
@@ -143,7 +143,7 @@ METHOD SetEncoder( cEnc ) CLASS TipMail
|
||||
ELSE
|
||||
::oEncoder := cEnc
|
||||
ENDIF
|
||||
::hHeaders[ "Content-transfer-encoding" ] := ::oEncoder:cName
|
||||
::hHeaders[ "Content-Transfer-Encoding" ] := ::oEncoder:cName
|
||||
RETURN .T.
|
||||
|
||||
METHOD SetBody( cBody ) CLASS TipMail
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
#translate ( <exp1> LIKE <exp2> ) => ( hb_regexLike( (<exp2>), (<exp1>) ) )
|
||||
|
||||
FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aFiles, cUser, cPass, cPopServer, nPriority, lRead, bTrace, lPopAuth, lNoAuth, nTimeOut, cReplyTo, lTLS, cSMTPPass, cCharset )
|
||||
FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aFiles, cUser, cPass, cPopServer, nPriority, lRead, bTrace, lPopAuth, lNoAuth, nTimeOut, cReplyTo, lTLS, cSMTPPass, cCharset, cEncoding )
|
||||
/*
|
||||
cServer -> Required. IP or domain name of the mail server
|
||||
nPort -> Optional. Port used my email server
|
||||
@@ -137,6 +137,9 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
IF ! ISCHARACTER( cCharset )
|
||||
cCharset := "ISO-8859-1"
|
||||
ENDIF
|
||||
IF ! ISCHARACTER( cEncoding )
|
||||
cEncoding := "quoted-printable"
|
||||
ENDIF
|
||||
|
||||
cUser := StrTran( cUser, "@", "&at;" )
|
||||
|
||||
@@ -230,11 +233,11 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
oUrl:cUserid := StrTran( cUser, "&at;", "@" )
|
||||
|
||||
oMail := tipMail():new()
|
||||
oMail:SetEncoder( "7bit" )
|
||||
oMail:SetEncoder( cEncoding )
|
||||
oMail:SetCharset( cCharset )
|
||||
IF ! Empty( aFiles )
|
||||
oAttach := tipMail():new()
|
||||
oAttach:SetEncoder( "7bit" )
|
||||
oAttach:SetEncoder( cEncoding )
|
||||
oAttach:SetCharset( cCharset )
|
||||
|
||||
IF ( ".htm" $ Lower( cBody ) .OR. ".html" $ Lower( cBody ) ) .AND. hb_FileExists( cBody )
|
||||
@@ -243,7 +246,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
cBodyTemp := cBody
|
||||
cBody := MemoRead( cBodyTemp ) + Chr( 13 ) + Chr( 10 )
|
||||
ELSE
|
||||
oAttach:hHeaders[ "Content-Type" ] := "text/plain; charset=iso8851"
|
||||
oAttach:hHeaders[ "Content-Type" ] := "text/plain; charset=" + cCharset
|
||||
ENDIF
|
||||
oAttach:SetBody( cBody )
|
||||
oMail:Attach( oAttach )
|
||||
@@ -254,7 +257,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
cBodyTemp := cBody
|
||||
cBody := MemoRead( cBodyTemp ) + Chr( 13 ) + Chr( 10 )
|
||||
ELSE
|
||||
oMail:hHeaders[ "Content-Type" ] := "text/plain; charset=iso8851"
|
||||
oMail:hHeaders[ "Content-Type" ] := "text/plain; charset=" + cCharset
|
||||
ENDIF
|
||||
oMail:SetBody( cBody )
|
||||
ENDIF
|
||||
@@ -426,7 +429,7 @@ FUNCTION hb_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aF
|
||||
( cFile LIKE ".+\.(svr|wrl|wrz|vrt)" ) .OR. Empty( cFExt )
|
||||
oAttach:SetEncoder( "base64" )
|
||||
ELSE
|
||||
oAttach:SetEncoder( "7-bit" )
|
||||
oAttach:SetEncoder( cEncoding )
|
||||
ENDIF
|
||||
|
||||
cMimeText := hb_SetMimeType( cFile, cFname, cFext )
|
||||
|
||||
Reference in New Issue
Block a user