473,503 Members | 5,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing Email Content in Database

34 New Member
Hi,

Am using asp.net with C# (VS 2008) to send mails with attachments using SMTP server and MailMessage class.

Now i want to store this email message with attachment into SQL 2008 DB and later a windows service will send mails by gettnig the mail content from database.

Could anyone provide information on storing emails with attachment into DB.

Thanks.
Aug 26 '11 #1
1 3144
invoked
4 New Member
Hello Arulmanoj,

When we decided to use our DB for storing emails and attachments, we simply created a few tables for each purpose. One table exists for metadata such as email status, date received, customerID, etc. We then used the ID from this table to associate to the other necessary tables such as EmailMessage, EmailAddresses, EmailTemplate, and EmailFile. You may be thinking that this level of normalization is overkill but believe me when I say that I have yet to find a scenario where you can over-normalize although I'm sure someone will lend a hand in explaining one.

Back to the question. The EmailFile table is a simple table with an EmailID and a FileID and this allows user to attach multiple attachments to an email as a one-to-many relationship. On the other end of that FileID we have created a seperate DB for files(not required) and are using a table called File which has the following fields: FileID, MimeTypeID, FileName, FileDescription, UploadDate, UploadBy, and DeletedDate. Just as a reference, the MimeTypeID is linked to a MimeType DB table.

So that's almost it, the only other table is our FileBinary table that simply has a FileBinaryID as a PK, FileID as a FK to the file record, and lastly the FileBinary which is of type varbinary(max). We simply use the FileUpload control to capture the file binary. I also suggest having an allowed file types table and checking each file against them to ensure security when uploading files.

If there is something that I didn't cover or something you would like more clarification on, please ask away. I tried to do my best explaining this at a high level but I had way more to say.

Good luck!
Oct 3 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4615
by: Martin Körner | last post by:
Hi NG, I am using email module for creating mails with attachment (and then sending via smtplib). If the name of the attachment file is longer than about 60 characters the filename is wrapped...
1
1360
by: John South | last post by:
Hi I've developed a simple web service that lets people easily set up their own websites, and keep them up-to-date themselves. I'm storing all the content, including images in the SQL 2000...
6
2439
by: Bartosz Wegrzyn | last post by:
hi, I would like to store windows passwords and usernames in database. Please tell me where to start? What database can I use? Can I use free microsoft database? Thanks Bart
0
1109
by: Merek | last post by:
Hi all, We need to allow the user to store, view and edit blocks of rich text via an ASP.NET application. After adopting one of the many rich text editors out there that outputs HTML we are...
2
1033
by: Paraki | last post by:
Hi, Anyone knows how to read the Fax and email content from an ASP page using the framework classes? Any help will be appreciated. Thanks in advance. -- K_
1
950
by: Daniel | last post by:
Hi All, i just wondering any control like email content where u can cut object from any application like excel chart and paste perfectly on the control. Any suggestion and guideline? your...
2
2180
by: walter | last post by:
Hi there, I'm wondering if it's possible to store the .net resource in database instead of resx file? Our site is a multi-lingual site ,storing text in resx file give us a burden on the website...
4
7236
by: Zeljko Bilandzija | last post by:
Hy, could someone help me in this: In design mode, i want to put pictures in database. I made column named pics, and its type as image. How can I put pictures or some address of these pictures...
6
1759
by: ej20 | last post by:
I have a php page that pulls email addresses from a MSSQL database. I am trying to insert these addresses into the BCC: Outlook via a link. my query is as follows:$connect = mssql_connect(SERVER,...
2
2616
by: sethupnr | last post by:
how can i add a pdf file as email content. I tried <iframe> trag but it doesnt working. I dont need to attach the pdf as attachment. i'm using PhpMailer function. Also how can i link to a...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.