
CREATE TABLE IF NOT EXISTS `mail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` varchar(512) NOT NULL,
  `id_kont` varchar(512) NOT NULL,
  `time` int(11) NOT NULL,
  `msg` varchar(10240) NOT NULL,
  `read` set('0','1') NOT NULL DEFAULT '0',
  `deleted` int(1) NOT NULL DEFAULT '0',
  `type` varchar(512) DEFAULT 'personal',
  `attachments` int(1) DEFAULT '0',
  `flaggedTo` varchar(11) DEFAULT 'inbox' COMMENT 'inbox|deleted|spam|archive|favorite',
  `flaggedFrom` varchar(11) DEFAULT 'inbox' COMMENT 'inbox|deleted|spam|archive|favorite',
  PRIMARY KEY (`id`),
  KEY `read` (`read`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `mail_files` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(512) NOT NULL,
  `md5` varchar(512) NOT NULL,
  `id_user` varchar(512) NOT NULL,
  `id_kont` varchar(512) NOT NULL,
  `ras` varchar(36) NOT NULL,
  `type` varchar(64) NOT NULL,
  `size` int(11) NOT NULL,
  `email_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `mail_to_send` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mail` varchar(64) NOT NULL,
  `them` varchar(32) NOT NULL,
  `msg` varchar(9999) NOT NULL,
  `time` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;