473,654 Members | 3,040 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 3154
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
4642
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 in the Content-Disposition header: Content-Disposition: attachment; filename="This is a sample file with a very long filename
1
1366
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 database. So far it's working well enough. Is there likely to be a performance or reliability problem as the system grows? You can see it in operation here: www.up-to-the-minute.com
6
2446
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
1117
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 storing that HTML directly in the database. The problem emerges when we try to feed this data to a reporting solution. Our current platform, Crystal Reports + Enterprise does not allow for
2
1041
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
957
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 help will be appreciated. thank you Best regards,
2
2188
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 deployment since the text is changed often. I'm thinking to store the text in database and establish a way to still leverage the localization feature provided by .NET framework.
4
7248
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 in that column, or i maybe need to put pictures in Add_Data folder and make reference from there, or what I need to do? could someone explain me that process of putting at least one picture in database, I'm using Microsoft SQL Server 2005
6
1767
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, LOGIN, PASS) or die("Couldn't connect to SQL Server on SERVER"); $database = mssql_select_db(DBNAME,$connect) or die("Couldn't open database $DBNAME"); $query = "SELECT Distinct ClcEmail FROM ClientContact WHERE Deleted = 0 AND...
2
2624
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 particular pdf page. Is it possible with #page=3 thanks
0
8375
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1593
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.