Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Create EDIFACT MIMECreate an EDIFACT MIME message. uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, CHILKATMIMELib_TLB, OleCtrls; ... procedure TForm1.Button1Click(Sender: TObject); var mime: CHILKATMIMELib_TLB.IChilkatMime; success: Integer; ediBody: String; begin mime := CoChilkatMime.Create(); success := mime.UnlockComponent('Anything for 30-day trial.'); if (success = 0) then begin ShowMessage('Failed to unlock'); Exit; end; // Assuming you have an EDIFACT document loaded into // a string variable, set the MIME body with it: ediBody := 'UNB+IATB:1+6XPPC+LHPPC+940101:0950+1'' ...'; mime.SetBodyFromPlainText(ediBody); // The call to SetBodyFromPlainText automatically set the // content-type to "text/plain". // However, we want: application/EDIFACT; name=om080923.edi mime.ContentType := 'application/EDIFACT'; mime.Name := 'om080923.edi'; // We want the content-disposition to be: // Content-Disposition: attachment; filename="om080923.edi" mime.Disposition := 'attachment'; mime.Filename := 'om080923.edi'; // Make sure the content-transfer-encoding is 7bit: // Content-Transfer-Encoding: 7bit mime.Encoding := '7bit'; // Note: MIME header fields are case insensitive. // Add a few other header fields: mime.AddHeaderField('Message-ID','<CHILKAT-MID-83cf2fbf-10cb-4322-ad79-4c1097fd56f2@Matt>'); mime.AddHeaderField('From','support@chilkatsoft.com'); mime.AddHeaderField('To','admin@chilkatsoft.com'); mime.AddHeaderField('Subject','This is a test'); mime.AddHeaderField('MIME-VERSION','1.0'); mime.AddHeaderField('Date','Tue, 23 Sep 2008 07:26:39'); // Display the complete MIME: Memo1.Lines.Add(mime.GetMime()); end; |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.