Complete Virtual Mail Server/Web Access/pt-br
Introdução
Uma função muito utilizada de um sistema de e-mail é o acesso web. Alguns usuários o usam como único modo de acesso, outros o usam como backup quando seu sistema próprio não está disponível. Existem várias opções disponíveis, sendo o mail-client/squirrelmail e o mail-client/roundcube os mais comuns. Squirrelmail pode ser utilizado se a o uso da largura de banda da rede for problema, o Roundcube é recomendado caso contrário e o foco deste artigo.
Instalando o roundcube
O Roundcube pode armazenar sua configuração em um banco de dados. Coisas como livro de endereços, identidades etc podem ser armazenadas lá também.
Here there are several options available. Use a local, per vhost based SQLite storage pool, use a postgres/mysql database per vhost or have all vhosts share the same database. There can be advantages for any of the above options. If webmail, for various domains, is on the same host as the imap server, then using one database for all domains is fine and can be an advantage. It could be desired that each domain, each vhost gets its own webmail interface (different skin and plugins) where all users could still log in. Meaning in the event of one of the vhosts webmail being broken, they can still access their e-mail normally using a different vhost. Whether the users settings 'live' in all vhosts or not, is based on the imap server. Roundcube bases its user id on the mail_host
e.g. the imap server and thus when using localhost the user 'profile' is identical everywhere.
USE flags for mail-client/roundcube A browser-based multilingual IMAP client with an application-like user interface
change-password
|
Allow users to change passwords through Roundcube |
enigma
|
Add dependencies to support server-side GnuPG signing and/or encryption through the enigma plugin |
exif
|
Add support for reading EXIF headers from JPEG and TIFF images |
fileinfo
|
Use the dev-lang/php fileinfo extension to guess the mime_type of attachments |
ldap
|
Add dependencies to support connecting to an LDAP address book server |
mysql
|
Add mySQL Database support |
postgres
|
Add support for the postgresql database |
spell
|
Add dictionary support |
sqlite
|
Add support for sqlite - embedded sql database |
ssl
|
Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security) |
vhosts
|
Add support for installing web-based applications into a virtual-hosting environment |
zip
|
Enable support for ZIP archives |
Only
postgres
or mysql
is required when not using sqlite
.After choosing the appropiate USE flags, roundcube should be emerged:
root #
emerge --ask mail-client/roundcube
This only installs roundcube to the host, but not into the vhost.
root #
webapp-config -I -h webmail.example.com -d roundcube roundcube 1.0.5
If you get an error with webapp-config, try using this syntax instead:
root #
webapp-config -h webmail.example.com -d roundcube -I roundcube 1.0.6
Usando Postgres
Unless there is some serious security concern, only one database user is required to access all databases used by roundcube:
root #
createuser -U postgres -D -P -R -S roundcube
Enter password for new role: $password Enter it again: $password
Roundcube will also need a database. Different names will have to be chosen when using different databases per domain:
root #
createdb -U postgres roundcubemail -O roundcube
Having roundcube in a separate directory is incredibly useful. Installing (and testing) a second webmail client, for example, or migrating to a new one, can be so much easier having it on the same host. However, the standard URL, webmail.example.com won't open up roundcube anymore. To fix this, create the following file as index.php in the root of htdocs directory.
'"`UNIQ--pre-00000005-QINU`"'
Configurando o Roundcube
Configuring roundcube has become incredible easy. Just visit http://webmail.example.com/roundcube/installer/ and follow the on screen instructions, correcting any issues as they pop up.
Below are the old instructions when manually creating the config.inc.php file. The installer should still be used to create the database, which it has a button for.
Configurando o Roundcube (manualmente)
Configuring roundcube is as simple as editing two configuration files in /var/www/webmail.example.com/htdocs/roundcube/config/.
To access the database only the following line needs to be changed. The user name chosen earlier is roundcube. Replace pass in this line with the password chosen earlier:
$rcmail_config['db_dsnw'] = 'pgsql://roundcube:pass@localhost/roundcubemail';
Next listed are the essential changes required for roundcube operation. More can be done to personalize the setup:
-$rcmail_config['default_host'] = '';
+$rcmail_config['default_host'] = 'localhost';
-$rcmail_config['smtp_server'] = '';
+$rcmail_config['smtp_server'] = 'localhost';
// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
+$rcmail_config['smtp_user'] = '';
-$rcmail_config['smtp_user'] = '%u';
// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
-$rcmail_config['smtp_pass'] = '';
+$rcmail_config['smtp_pass'] = '%p';
// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
-$rcmail_config['des_key'] = 'rcmail-!24ByteDESkey*Str';
+$rcmail_config['des_key'] = '$supersecret24bytestring';
Starting with Roundcube version 0.6, Roundcube needs to have the fully qualified names for the default storage folders, such as Trash, Drafts etc:
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['drafts_mbox'] = 'Drafts';
+$rcmail_config['drafts_mbox'] = 'INBOX.Drafts';
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['junk_mbox'] = 'Junk';
+$rcmail_config['junk_mbox'] = 'INBOX.Junk';
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['sent_mbox'] = 'Sent';
+$rcmail_config['sent_mbox'] = 'INBOX.Sent';
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['trash_mbox'] = 'Trash';
+$rcmail_config['trash_mbox'] = 'INBOX.Trash';
// NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP)
-$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
+$rcmail_config['default_imap_folders'] = array('INBOX', 'INBOX.Drafts', 'INBOX.Sent', 'INBOX.Junk', 'INBOX.Trash');
Testando o Roundcube
Faça login no webmail pelo endereço http://webmail.example.com/ e a caixa postal de teste deve ser mostrada. Também o envio de e-mail deve funcionar corretamente.