TAttach Component =================== Developed by : Ing. Antonio Cracolici e-mail: , Legal stuff: - This component is not Freeware (I retain the copyright) - If you find it useful ...contact me and for 25$ i'll send you the code of AttachUnt.dcu. - not to be distributed for profit without my permission To register the component select from Delphi 2 the Component menu -->Install... --->Add and Select the AttachUnt.dcu. If using the component the message 'Error : MimeType.ini not found' is shown, then from the object inspector select the IniFileName property to find it. TAttach Object I apologize for my bad english...it is not my mother language, i'm italian. I'll try to explain the TAttach object i have made...but please contact me at my e-mail if any words or phrases is not clear... Type TAttachFileName = Type String; it is Necessary for the property Editor TProgressEvent = Procedure (Sender: TObject; Progress: Integer) of object; Properties: AttachFileName : TAttachFileName; - The built-in property editor helps you to select the file then the Header property is created and naturally update all the fields of the object...but the AttachFileName is not encoded. You MUST use the encode method at run time!!! IniFileName : String; - The built-in property editor helps you to select the file. The name of the IniFileName...see the MymeType.ini file!!! This file is fundamental for a correct Header. Note You can add your own section. As you can see every section has this format: [EXT] ContentType=... Disposition=... Description=... EncType=... for example, for the jpg files [Jpg] ContentType=Image/Jpeg Disposition=Inline Description=(JPG File) EncType=Base64 LineAfterHeader : String; - This Line is inserted after the header; LineAfterMessage : String; - This Line is inserted after the message; (Please Note that message is only the encoded file!!!) LineBeforeHeader : String; - Well...i think you have understood ;-D LineBeforeMessage : String; - Well...i think you have understood ;-D PutHeader : Boolean; - If True the header is inserted in the encoded file! At Run time: ExtractedFileName : String ; Read Only; ExtractedFilePath : String ; Read Only; OriginalSize: String ;Read Only; ContentType : String ;Read Only; EncType : String ;Read Only; Disposition : String ;Read Only; Description : String ;Read Only; Header : TStrings Read/Write; - The Header!!! Please note it is Read/Write!!! You can add informations at run time!!! Lines : TStrings; Read Only; - The coded message with the Header if the field 'PutHeader' is true Methods Function Encode : Boolean; - The file in "AttachFileName" is encoded if the IniFileName exists!!! Function EncodeFile(Const FileName : String): Boolean; - The File "FileName" is encoded if the IniFileName exists!!! Function Execute : Boolean; - At Run time an OpenDialog Window is shown and the selected file is encoded if the IniFileName exists!!! Events: OnBeforeInsertHeader(Sender : TObject); - Action to do Before Insert Header...you can add at this point any additional user data, naturally using TAttach.Header.Add('Something Before at run time...') OnChangeProgress(Sender : TObject; Progress: Integer); - The Field Progress is the current progress encoding in percentuage during the encode method. OnHeaderInserted(Sender : TObject); - Action to do After the Header is inserted...you can add at this point any additional user data, naturally using TAttach.Header.Add('Something After at Run Time...') Structure of TAttach.Lines ============================ ----------------------Lines---------------------------------------------- Line Inserted using the OnBeforeInsertHeader method at RT Line Inserted using the LineBeforeHeader in Designer Content-Type:application/octet-stream;name="Arj.exe" H Content-Transfer-Encoding:Base64 EA Content-Description:Arj.exe (EXE File) D Content-Disposition:attachment;Filename="Arj.exe" ER Line Inserted using the LineAfterHeader in Designer Line Inserted using the OnHeaderInserted method at RT Line Inserted using the LineBeforeMessage in Designer TVpgAOMAbAFgAOwB///KHYAAAAAAAAAAPgAAAAEA+zBqcgAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAABAAAA3gAAABABAAAUBQAA2wQAAMoEAAC8BAAAsAQAAKgEAACaBAAAiwQAAHwE AAB0BAAAlAIAAMoHAACqGgAAlBoAAHYaAABlGgAAVh... ... FBQUFA8XDwgUFBQHFBYUFBQUFBQUFBQNFBQUFBQUFBQUFBAKDw8PCAoUFAYUEgsOFBQRFAwU FA0UFBQUFBQUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Line Inserted using the LineAfterMessage in Designer ----------------------Lines---------------------------------------------- I hope it is sufficient...e-mail me if You like the component or if You have questions or any suggestions. Ciao a Tutti!!! :-D