Advertisement
d1cor

mysql-smtp

Apr 22nd, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 3.15 KB | None | 0 0
  1. *Creacion de las tablas en mysql
  2. mysql localhost -u root -p
  3.  
  4.     CREATE DATABASE postfix;
  5.     GRANT SELECT, INSERT, UPDATE, DELETE ON postfix.* TO 'postusr'@'localhost' IDENTIFIED BY '1234';
  6.     GRANT SELECT, INSERT, UPDATE, DELETE ON postfix.* TO 'postusr'@'localhost.localdomain' IDENTIFIED BY '1234';
  7.     FLUSH PRIVILEGES;
  8.     USE postfix;
  9.  
  10.  
  11. mysql -u root -p < archivo.sql
  12. (donde archivo.sql es lo siguiente)
  13.  
  14. DROP TABLE IF EXISTS `users`;
  15. CREATE TABLE `users` (
  16. `id` varchar(128) NOT NULL default '',
  17. `address` varchar(128) NOT NULL default '',
  18. `crypt` varchar(128) NOT NULL default '',
  19. `clear` varchar(128) NOT NULL default '',
  20. `name` varchar(128) NOT NULL default '',
  21. `uid` smallint(5) unsigned NOT NULL default '1000',
  22. `gid` smallint(5) unsigned NOT NULL default '1000',
  23. `home` varchar(128) NOT NULL default '/',
  24. `domain` varchar(128) NOT NULL default '',
  25. `maildir` varchar(255) NOT NULL default '',
  26. `quota` bigint(20) DEFAULT '10485760',
  27. `imapok` tinyint(3) unsigned NOT NULL default '1',
  28. `bool1` tinyint(3) unsigned NOT NULL default '1',
  29. `bool2` tinyint(3) unsigned NOT NULL default '1',
  30. PRIMARY KEY (`id`),
  31. UNIQUE KEY `id` (`id`),
  32. UNIQUE KEY `address` (`address`),
  33. KEY `id_2` (`id`),
  34. KEY `address_2` (`address`)
  35. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  36.  
  37.  
  38. DROP TABLE IF EXISTS `domains`;
  39. CREATE TABLE domains (
  40. domain varchar(50) NOT NULL,
  41. PRIMARY KEY (`domain`)
  42. ) TYPE=MyISAM;
  43.  
  44.  
  45. DROP TABLE IF EXISTS `forwardings`;
  46. CREATE TABLE `forwardings` (
  47. `source` varchar(80) NOT NULL,
  48. `destination` TEXT NOT NULL,
  49. PRIMARY KEY (`source`)
  50. ) TYPE=MyISAM;
  51.  
  52.  
  53.  
  54. CONFIGURACION POSTFIX PARA USUARIOS VIRTUALES:
  55. editar /etc/postfix/main.cf
  56. agregar las lineas:
  57.  
  58. virtual_alias_domains =
  59. virtual_mailbox_base = /home/vmail/
  60. virtual_uid_maps = static:5000
  61. virtual_gid_maps = static:5000
  62. virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf
  63. virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
  64. virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
  65.  
  66. ARCHIVOS DE CONFIGURACION EN /etc/postfix/
  67. #DOMINIOS VIRTUALES CON LOS QUE VA A TRABAJAR POSTFIX
  68.     /etc/postfix/mysql-virtual_domains.cf
  69. user = postusr
  70. password = 1234
  71. dbname = postfix
  72. table = domains
  73. select_field = domain
  74. where_field = domain
  75. hosts = 127.0.0.1
  76.  
  77.  
  78. #CONFIGURACION DE FORWARDINGS
  79.     /etc/postfix/mysql-virtual_forwardings.cf
  80. user = postusr
  81. password = 1234
  82. dbname = postfix
  83. table = forwardings
  84. select_field = destination
  85. where_field = source
  86. hosts = 127.0.0.1
  87.  
  88.  
  89. #CONFIGURACION DE LAS CASILLAS DE CORREO DE LOS USUARIOS
  90.     /etc/postfix/mysql-virtual_mailboxes.cf
  91. user = postusr
  92. password = 1234
  93. dbname = postfix
  94. table = users
  95. select_field = maildir
  96. where_field = email
  97. hosts = 127.0.0.1
  98.  
  99. CREAMOS UN USUARIO EN LA BASE DE DATOS: (modificar los datos)
  100. insert into users values ('dicor@midominio.com','dicor@midominio.com',encrypt('1234'),'','Diego Cordoba',5000,5000,'/home/vmail/','midominio.com','midominio.com/dicor/Maildir/',0,1,1,1);
  101.  
  102. CREAMOS UN DOMINIO:
  103. INSERT INTO `domains` (`domain`) VALUES ('midominio.com');
  104.  
  105. CREAMOS UN ALIAS:
  106. INSERT INTO `forwardings` (`source`, `destination`) VALUES ('ventas@midominio.com', 'dicor@midominio.com');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement