Adicionar conta de e-mail - Postfix com domínios virtuais no MySQL
Publicado por Geovanny Junio da Silva 16/12/2008
[ Hits: 10.595 ]
Homepage: http://comonus.com
Script para adicionar manualmente contas de e-mail em um servidor Postfix com domínios virtuais.
Usage: adduser_postfix.pl email@dominio.com.br
#!/usr/bin/perl
#
# (c) 2008 Geovanny Junio <geovanny@eutsiv.com.br>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
use strict;
use warnings;
use DBI;
my $mail = shift;
my $home_base = '/mail/spool/correio';
my $user;
my $domain;
($user, $domain) = split('@', $mail);
my $userdir = "$home_base/$domain/$user";
unless( -e "$home_base/$domain" ) {
mkdir("$home_base/$domain", 770) or die "Nao foi possivel criar o diretorio $home_base/$domain: $!\n";
}
unless( -e "$userdir" ) {
mkdir($userdir, 770) or die "Nao foi possivel criar o diretorio $userdir: $!\n";
}
system("maildirmake $userdir/Maildir");
system("chmod -R 770 $userdir");
system("chown -R maildrop:www-data $userdir");
my $dsn = 'DBI:mysql:postfix:localhost';
my $db_user_name = 'user';
my $db_password = 'password';
my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
$dbh->do("insert into mailbox(username, password, name, home, maildir, quota, domain) values('$mail',encrypt('juridica'),'$mail','$home_base/','$domain/$user/Maildir/','20480000S','$domain')");
$dbh->disconnect();
Notificador de Gmail no Conky.
Remover caixas postais do Cyrus IMAP
Apagar MAILER-DAEMON da fila de email
Apagar spam na fila do postfix por palavra
Nenhum comentário foi encontrado.
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
[Resolvido] VirtualBox can't enable the AMD-V extension
Como verificar a saúde dos discos no Linux
Como instalar , particionar, formatar e montar um HD adicional no Linux?
Como automatizar sua instalação do Ubuntu para desenvolvimento de software.
Fiz uma pergunta no fórum mas não consigo localizar (20)
Quais os códigos mais dificeis que vcs sabem fazer? (8)
Pfsense inacessivel após um periodo de tempo (1)
Não consigo instalar distro antiga no virtualbox nem direto no hd (9)









