MailMessage when attachments are stored in database

  • Thread starter Thread starter doug.hughes
  • Start date Start date
D

doug.hughes

Hi

I wrote an email queuing application in ASP / CDO, which uses a
database as it's source. It reads email parameters (From, To, Subject,
etc.) from a database, constructs then sends mail messages.

It also stores attachments in a database binary field and
programatically attaches them to the mail message.

With CDO, a call to Message.Attachments.Add returns a message body
part. The content of the body part can then be set (using a stream
filled from the database binary field), together with the content type
and encoding.

This all works fine, but now I need to port the code to C# / .NET.

I thought this would be a piece of cake with .NET, but apparantly not!

Can anyone give me any pointers where to start?

Thanks in advance

Doug
 
Hi,

Probably the easiest way is to use some .NET based mime constructor + smtp
client to construct and send messages.

CDO in .NET can be head ache in .NET.
 
Ivar

Many thanks for the response.

Are there any .NET classes for constructing MIME documents, or must I
really create the message from scratch? Any ideas how best to approach
this?

What's your opinion of using the CDO / ADODB COM components in the .NET
project? I presume .NET uses interops to call the COM methods. Any
downsides?

Thanks

Doug
 
Are there any .NET classes for constructing MIME documents
Yes, there are some.
It's my written SMTP + MIME, you may try to use
this(http://www.lumisoft.ee/lsWWW/download/downloads/Examples/)
If sample app isn't enough for you, you can contact me directly.
What's your opinion of using the CDO / ADODB COM components in the .NET
project? I presume .NET uses interops to call the COM methods. Any
downsides?
*) One the biggest, CDO isn't redistributable - user must install it from MS
office.
*) Using it as activex from .NET is headache
*) Your program isn't copyable (because cdo), with native .NET component you
can do this.
 
Ivar

Thanks for your continued assistance.

I tried using CDO dll via interop, and it all seemed to work OK.
Distribution it not an issue as it's a web app, and the hosting company
has CDO installed.

I will look at your sample code however, as I'm just starting with
..NET, so all references are helpful.

Thanks once again.

Doug
 
Back
Top