RFC: Building a Web Mail Application with Attachment Capability

  • Thread starter Thread starter Chris Welch
  • Start date Start date
C

Chris Welch

I'm developing a very small Web-based mail application as part of a
larger Online Contact System for a client. I was struggling for a few
hours with how to handle e-mail attachments and I thought I'd post my
solution to see if there are any better solutions out there.

My thoughts are that I would use associate each response with a
System.Guid.NewGuid() and then as the message is created, the app
would create a directory in the temp folder with the Guid as the
directory name. As users upload attachments, the files would be saved
in the message's directory. This stops one of my problems which was,
if you have one shared temporary file directory, how do you preserve
the name of the attachment if the same filename is attached to
multiple messages by one user or multiple users attach a file of the
same name at the same time.

To handle the removal of the files, it could be implementation
specific, such as the message's directory could be removed on sending,
if no archiving is necessary, or the message directory could be
removed when the message is removed.

I am aware of the CDO and the ability to attach files from memory, but
users will be able to view many pages before the message is actually
sent, and I dont' want all those attachments hanging around in Session
variables or ViewState for that long - it seems like a huge waste of
resources especially if 100 people are working on the system attaching
files.

I really would appreciate your thoughts and comments.

Chris
http://www.chriswelch.com/
 
Chris,

Your solution sounds fine to me.

An alternative would be to store the files in a database. I don't really see
any major benefits to that over your solution though.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Back
Top