473,221 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 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 2216
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Osiris Sawiris | last post by:
I inherited an Inventory control application that updates the stock from the branches at the end of each day. We receive the stock transactions via e-mail attachments (Excel Sheets). Those...
1
by: Trond A. S. Andersen | last post by:
Hi all, I'm working on a project in which i need to send mail attachments in the form of Excel documents from a .NET C# application. I've written a class which creates the Excel document using...
4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
3
by: Simon Knox | last post by:
Hi I have come across an apparant bug while using SmtpMail. The problem I have is that if a MailAttachment has a line in it that starts with a fullstop ( or period for those of you that speak...
4
by: Mark Rae | last post by:
Hi, Can anyone please tell me if it's possible to pass a System.Web.Mail.MailMessage object to a ASP.NET Web Service? Maybe using XML Serialization / Deserialization? I've been asked to...
6
by: Frank | last post by:
Straightforward VB.NET 2002 code that works form both Windows and ASP.NET apps on a Windows 2000 machine, and works in the Windows app on a newly installed XP machine, but fails in the ASP.NET...
5
by: doug.hughes | last post by:
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...
2
by: asnowfall | last post by:
I am trying to build System.Mail.MailMessage object out of mime encoded SMTP data. I have following questions Byte byteMailData; //mime encoded STMP data for "email with attachment" 1)...
4
by: a | last post by:
Hi I want my application uses the instance of MailMessage and SmtpMail classes to send email. How can I add a reference to the System.Web.dll assembly to use these classes? Do the SmtpMail...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.