diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f4583a09a2..23efaf4a9b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -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. diff --git a/harbour/contrib/hbtip/encqp.prg b/harbour/contrib/hbtip/encqp.prg index 6e00e14b9a..9299e95a30 100644 --- a/harbour/contrib/hbtip/encqp.prg +++ b/harbour/contrib/hbtip/encqp.prg @@ -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 diff --git a/harbour/contrib/hbtip/mail.prg b/harbour/contrib/hbtip/mail.prg index 7a7896c014..2ee41be31e 100644 --- a/harbour/contrib/hbtip/mail.prg +++ b/harbour/contrib/hbtip/mail.prg @@ -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 diff --git a/harbour/contrib/hbtip/sendmail.prg b/harbour/contrib/hbtip/sendmail.prg index 6d36c09405..9c6b3ce534 100644 --- a/harbour/contrib/hbtip/sendmail.prg +++ b/harbour/contrib/hbtip/sendmail.prg @@ -55,7 +55,7 @@ #translate ( LIKE ) => ( hb_regexLike( (), () ) ) -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 )