471,348 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

MailMessage when attachments are stored in database

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

Jul 21 '05 #1
7 2144
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.
<do*********@johncrane.co.uk> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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

Jul 21 '05 #2
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.
<do*********@johncrane.co.uk> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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

Jul 21 '05 #3
If you want to use the classes of the namespace System.Web.Mail, you can use
the MailAttachment class. However, this class requires you to save the
attachments to disk first.

http://msdn.microsoft.com/library/de...classtopic.asp

HTH, Jakob.

--
http://www.dotninjas.dk
"do*********@johncrane.co.uk" wrote:
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

Jul 21 '05 #4
If you want to use the classes of the namespace System.Web.Mail, you can use
the MailAttachment class. However, this class requires you to save the
attachments to disk first.

http://msdn.microsoft.com/library/de...classtopic.asp

HTH, Jakob.

--
http://www.dotninjas.dk
"do*********@johncrane.co.uk" wrote:
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

Jul 21 '05 #5
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
Ivar wrote:
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.
<do*********@johncrane.co.uk> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
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


Jul 21 '05 #6
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/downloa...oads/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.

<do*********@johncrane.co.uk> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... 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
Ivar wrote:
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.
<do*********@johncrane.co.uk> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
> 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
>

Jul 21 '05 #7
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

Jul 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Osiris Sawiris | last post: by
1 post views Thread by Trond A. S. Andersen | last post: by
4 posts views Thread by Trond A. S. Andersen | last post: by
6 posts views Thread by Frank | last post: by
2 posts views Thread by asnowfall | last post: by
4 posts views Thread by a | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.