Link to home
Start Free TrialLog in
Avatar of bjohns33
bjohns33

asked on

system.web.mail.mailattachment with database stored attachments

Hi all

Is there anyway that I can add an attachment to my mail from the database stored representation of an attachment (storing doc name, mime type and text stream) without first storing it to disk?

Are URLs acceptable parameters to mailattachment?  Is there another way, which does't involve a url call?

Thanks
Ben
ASKER CERTIFIED SOLUTION
Avatar of ptmcomp
ptmcomp
Flag of Switzerland 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
Avatar of bjohns33
bjohns33

ASKER

Hi ptm, thanks for the response - even though slightly depressing ;-)

Rama

The link listed unfortunately uses the write to disk approach, which is what I'd ideally like to avoid.

Cheers
Ben
What do you mean by being depressing? It contains the XSL and the whole source code.
"Doesn't seem to be possible. There is neither a base class, a protected method nor an interface :o(."?

Thought that was quite depressing, lol.  Are you in another thread at the same time?

Oops mixed up two threads - should only do one thing at one time. I'm not multitasking compliant...
lol, was getting worried if i needed XSL for this.
Haha, I was going through RK's link looking for XSL.

Anyway, bjohns33, you can do what you would like using CDONTS, or a 3rd Party Mail component.  I was looking for an example for you for CDO, but I have not found one yet (although I *have* seen them).  I will keep looking, but just to get you headed in some direction...
[I think I opened more than one Email and thought I clicked on the other thread's link.]
Yes, eternal_21 is right it can be done by a different mail component. CDO could be one. You could also use one of many freeware components. Else just create a temporary file on disk even it's not that clean.
Yes, might have to bite the bullet and go for the temporary file - you know how it is, always want to make it as elegant as possible!  I think CDO is probably going to open up a whole world of pain, and this is part of a solution that may be sold in the future, so freeware licensing is going to be a problem.

Thanks both for your help - not sure where the points go though!
How do you want to continue? Mailcomponent, CDO or file?
Send the points ptmcomp's way.  He did answer your question exactly, and was 100% correct: You cannot send an attachment using System.Web.Mail without storing it in the file system.
Fair point eternal.  I think I'm going to go file system.  Thanks for the discussion - shame it isn't possible without add-ins.