hat jemand die Erfahrung gemacht, dass eine PDF im Mail-Anhang mit der Version 1354 zu '501 Syntax error - line too long' führt?
Dieselbe PDF wird mit Version 972 ohne Code-Änderungen problemlos versandt. Der Code dazu ist schlicht. Die Anwendung läuft mit OEM-Zeichensatz.
Code: Alles auswählen
METHOD MailVersand:MimeDatei( cDatei )
LOCAL cContent := ''
LOCAL cExtension := ''
LOCAL cType := ''
LOCAL nCharSet := Set( _SET_CHARSET, CHARSET_ANSI )
LOCAL nHandle := 0
LOCAL oMimeContent := NIL
// Inhalt der Datei in den Speicher laden
nHandle := FOpen( cDatei )
cContent := Space( FSize( nHandle ))
FRead( nHandle, @cContent, Len( cContent ))
FClose( nHandle )
cContent := Bin2Base64( cContent )
cExtension := Lower( SubStr( cDatei, RAt( '.', cDatei ) + 1 ))
// Der Content type (application/pdf) muss entsprechend der Extension gewählt werden
cType := 'application/' + cExtension + '; name=' + ::EncodeHeader( NurDateiName( cDatei ))
// Die Methode MimeContent:init( cContent, cType, cEncoding ) ist nicht dokumentiert
oMimeContent := MimeContent():new( cContent, cType, 'base64' )
Set( _SET_CHARSET, nCharSet )
RETURN( oMimeContent )
METHOD MailVersand:EncodeHeader( cHeader )
RETURN( "=?UTF-8?B?" + Bin2Base64( ksChar2Utf8( cHeader )) + "?=" )