Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
in EAGetMail Attachment object,
Attachment.Content property returns binary data with SafeArray Type.
Many Delphi users asked me how to convert the SafeArray to Stream in delphi,
Here is the example code:
procedure TForm1.LoadAttToStream( att: IAttachment ); var i: integer; lbound: integer; ubound: Integer; len: integer; buffer: array of byte; myarray: OleVariant; stream: TMemoryStream; begin myarray := att.Content; lbound := VarArrayLowBound(myarray, 1 ); ubound := VarArrayHighBound(myarray, 1 ); len := ubound - lbound + 1; if len = 0 then exit; SetLength( buffer, len ); for i := VarArrayLowBound(myarray, 1 ) to ubound do begin buffer[i] := VarArrayGet( myarray, i ); end; stream := TMemoryStream.Create(); stream.WriteBuffer( buffer[0], len ); stream.SaveToFile( 'c:\my folder\' + att.Name ); //save stream to file. stream.Free(); end;Edited by user Friday, November 8, 2013 6:58:15 PM(UTC)
| Reason: Not specified
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.