Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching Files to emails problem

Status
Not open for further replies.

Modica82

Technical User
Jan 31, 2003
410
GB
Hi all,

i have a form on my webpage that i want to allow users to attach two documents to there emails. I know how to attach files to emails using the .Net functions in the System.Web.Mail namespace but this entails the files sitting on the servers file system.

I want to be able to attach emails that come from the client without having to buy a third party control. Has anyone got any ideas on how to do this?

Rob
 
Add a file uploade (HtmlInputFile or HtmlFileInput - can't remember which :p) to your e-mail page. Adding this will allow the user to upload files and attach them to the e-mail before it's sent.


-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Hi Atomic,

woudnt i still have to save the file to the file system before i attached it to the email?

I know using the code you gave me i can create an stream which i could (if i was clever) use to create a new class that could accept a stream instead of a string and attach to the email, but saying this i have no clue on how this could be achieved.

What i am trying to achieve is attaching the file to the email without having to save it to the file system.

any ideas anyone?

Rob
 
Rob,

I haven't looked too hard, but it seems it's not possible to stream files into mail attachments (according to this site anyways):
One alternative, albeit it would be a great deal of development time, is to create your own mail library that allows you to stream attachments.

If you haven't dealt directly with SMTP or MIME encoding, reading these should get you started (yes, they are dry reading ;))

(SMTP)
(MIME Encoding)

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Hi Atomic,

For the time being i have just attached the file onto the file system, attached it to my email, sent the email and then deleted the files.

For the time being it will have to do, but thanks for the links.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top