Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3668614
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:08:37+00:00 2026-05-19T02:08:37+00:00

I am creating a communication module with email and onsite messaging. 4 questions: 1)

  • 0

I am creating a communication module with email and onsite messaging. 4 questions:

1) When storing the messages, it can belong to folders (Spam, trash, inbox, outbox, etc). Are these separate tables or 1 table with just a column for “folder” which is FK to a “folder lookup table”?

2) Like on hotmail, a user can create x number of custom folders so how to represent that in the data model? I can say inbox = id 1, outbox = id 2, etc but for the custom folders like “vacation email”, “work email”, etc i am not sure how to show that in the Data model if a message resides in that folder.

3) One email goes to multiple people. Does this mean i need to have 1 row per user sent to?

4) Lastly, messages have attachments. i assume that means a separate attachments table which FK links to which ever table (s) are used for storing messages?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:08:38+00:00Added an answer on May 19, 2026 at 2:08 am

    1&2: Folders need to be an entity, relationship MessageFolder one to many to Message

    3: MessageUser entity with UserID, MessageID, Type (Sender,Recipient)

    4: Seperate table for attachments (MessageAttachments).

    Email message schema

    CREATE TABLE `message`
      (
         `id`       INTEGER NOT NULL AUTO_INCREMENT,
         `author`   INTEGER NOT NULL,
         `contents` TEXT NOT NULL,
         `subject`  TEXT NOT NULL,
         PRIMARY KEY (`id`)
      );
    
    CREATE TABLE `messagefolder`
      (
         `id`         INTEGER NOT NULL AUTO_INCREMENT,
         `id_message` INTEGER NOT NULL,
         `id_folder`  INTEGER NOT NULL,
         PRIMARY KEY (`id`)
      );
    
    CREATE TABLE `folder`
      (
         `id`   INTEGER NOT NULL AUTO_INCREMENT,
         `name` VARCHAR(200) NOT NULL,
         PRIMARY KEY (`id`)
      );
    
    CREATE TABLE `messageattachment`
      (
         `id`         INTEGER NOT NULL AUTO_INCREMENT,
         `fk_message` INTEGER NOT NULL,
         PRIMARY KEY (`id`)
      );
    
    CREATE TABLE `user`
      (
         `id` INTEGER NOT NULL AUTO_INCREMENT,
         PRIMARY KEY (`id`)
      );
    
    CREATE TABLE `messageuser`
      (
         `id`         INTEGER NOT NULL AUTO_INCREMENT,
         `fk_message` INTEGER NOT NULL,
         `type`       INTEGER NOT NULL,
         PRIMARY KEY (`id`)
      );;
    
    ALTER TABLE `message` ADD FOREIGN KEY (author) REFERENCES `user` (`id`);
    ALTER TABLE `messagefolder` ADD FOREIGN KEY (id_message) REFERENCES `message` (`id`);
    ALTER TABLE `messagefolder` ADD FOREIGN KEY (id_folder) REFERENCES `folder` (`id`);
    ALTER TABLE `messageattachment` ADD FOREIGN KEY (fk_message) REFERENCES `message` (`id`);
    ALTER TABLE `messageuser` ADD FOREIGN KEY (fk_message) REFERENCES `message` (`id`); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A little background: I'm creating a set of adapters to allow communication with mobile
When creating a criteria in NHibernate I can use Restriction.In() or Restriction.InG() What is
I am creating a webservice using Windows Communication Foundation (WCF) and I currently don't
I'm creating a WCF application where I'll be using certificates to encrypt the communication
Hi i wanna work with some bluetooth communication using my Android device. How can
Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select
Creating hashes of hashes in Ruby allows for convenient two (or more) dimensional lookups.
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=
Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?
When creating a web application, and lets say you have a User object denoting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.