Link to home
Start Free TrialLog in
Avatar of dealclickcouk
dealclickcouk

asked on

Send email attachments from a DB with Indy


Hi

I'm using indy in a Delphi 5 development to send emails, and I want to attach PDF doc's, however the PDF docs are in a blob field in a SQL server DB.

Is there a way to stream direct from the blob field to the attachment, without having to write it to a file.

I really don't want to have to create files, I know this would be simpler in many ways, but with many users using the system it becomes more complex etc...
ASKER CERTIFIED SOLUTION
Avatar of Ivanov_G
Ivanov_G
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dealclickcouk
dealclickcouk

ASKER


Think you're missing the point, I know I can get the blob to a file and then attach it, but I don't want to do this.

I am looking for a way to do it direct from the blob field. i.e. stream from field to attachment...

   ne method LoadFromFile. The constructor itself requires filename... I don't have another idea...
Avatar of kretzschmar
>I am looking for a way to do it direct from the blob field

in short, this is not possible
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
interesting, lee :-))
bleh .. it should descend from TIdMessagePart :-) .. or .. remove the ContentDisposition property (also it's Get/Set methods) .. and Encode should have Reintroduce directive .. I think :)

Sorry to be dumb here, but I'm not that experienced with Delphi, I'm more a VB developer.

Is the above code example to be used in a new unit, or in an existing one?

Also what do I call to use it?

And just to check, is this valid Delphi 5 code?

Again sorry for the dumb questions...
seems that one slipped by ..
it's a new unit
include it in your uses clause and call smtn like:
TIdAttachmentStr.Create(msg.MessagePart, YourMemoryStream);
where YourMemoryStream is a TMemoryStream in which you've loaded the blob data
do you still need this ?