CREATE TABLE aliases (
  local_part varchar(64) NOT NULL,
  domain varchar(200) NOT NULL,
  recipients text(2000),
  PRIMARY KEY (local_part,domain)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE blacklists (
  address varchar(64) NOT NULL,
  type enum('SENDER','HOSTREJ','REJRCPT') NOT NULL default 'SENDER',
  message varchar(255),
  PRIMARY KEY (address,type)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE callbackdomains (
  domain varchar(200) NOT NULL,
  type enum('NOENV','NOHDR','NORND','NODNS') NOT NULL default 'NOENV',
  PRIMARY KEY (domain,type)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE domains (
  domain varchar(200) NOT NULL,
  type enum('LOCAL','RELAY','VIRTUAL') default 'LOCAL',
  PRIMARY KEY (domain,type)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE hostlists (
  hostname varchar(64) NOT NULL,
  type enum('AVOIDTLS','TRYAUTH','NOCALL') NOT NULL default 'AVOIDTLS',
  PRIMARY KEY (hostname,type)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE userforward (
  local_part varchar(64) NOT NULL,
  domain varchar(200) NOT NULL,
  recipients text(2000),
  PRIMARY KEY (local_part,domain)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE users (
  id varchar(200) NOT NULL,
  name varchar(255),
  user_id int NOT NULL,
  crypt varchar(255),
  passwd varchar(255),
  uid int(10) NOT NULL,
  gid int(10) NOT NULL,
  mbox_host varchar(128) NOT NULL,
  shell varchar(32) NOT NULL,
  home varchar(128) NOT NULL,
  quota tinyint(4),
  active enum('Y','N') NOT NULL default 'Y',
  PRIMARY KEY (id,mbox_host)
) TYPE=MyISAM
  CHARACTER SET utf8;

CREATE TABLE whitelist (
  address varchar(64) NOT NULL,
  PRIMARY KEY (address)
) TYPE=MyISAM
  CHARACTER SET utf8;

GRANT SELECT ON personal.aliases, personal.blacklists, personal.callbackdomains, personal.domains, personal.hostlists, personal.userforward, personal.users, personal.whitelist TO personal_exim@'%';
GRANT SELECT ON personal.aliases, personal.blacklists, personal.callbackdomains, personal.domains, personal.hostlists, personal.userforward, personal.users, personal.whitelist TO personal_exim@localhost;
SET PASSWORD FOR personal_exim@'%' = PASSWORD('dFrt34@sOMiqzFF25');
SET PASSWORD FOR personal_exim@localhost = PASSWORD('dFrt34@sOMiqzFF25');
FLUSH PRIVILEGES;
