creating an e-mail with a dynamic word attachment

B

Bertus Dam

I'm trying to create an e-mail with a dynamic word attachment like this:

System.Web.Mail.MailAttachment cAtt = new
System.Web.Mail.MailAttachment("test.aspx");

test.aspx is a webform which does a:

Response.ContentType = "application/msword";
Response.AppendHeader("Content-disposition",
"attachment;filename=Word.doc");

and a couple of Response.Writes. That's my Word-document I want as the
e-mail attachment.

When I send the e-mail however, the file that gets attached is the test.aspx
file itself, instead of the "rendered" version. I know I can make a file on
the server with a streamwriter and attach that file, but that's not what I
want. I want the attachments to be dynamically generated. Does anyone know
how to do this?


Bertus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top