| Line 290: |
Line 290: |
| | server_set_id = $auth1 | | server_set_id = $auth1 |
| | </nowiki> | | </nowiki> |
| | + | |
| | + | === Dovecot === |
| | + | Make sure you choose split files, can be fixed with: |
| | + | dpkg-reconfigure dovecot-core |
| | + | |
| | + | Find mail user uid & gid: |
| | + | cat /etc/passwd | grep mail |
| | + | |
| | + | ADD to the file /etc/dovecot/dovecot.conf |
| | + | <nowiki>protocols = imap |
| | + | listen = *, ::</nowiki> |
| | + | |
| | + | Add to the file /etc/dovecot/conf.d/10-mail.conf |
| | + | <nowiki>mail_location = maildir:~</nowiki> |
| | + | |
| | + | ADD to the file /etc/dovecot/conf.d/10-auth.conf |
| | + | <nowiki>!include auth-sql.conf.ext</nowiki> |
| | + | |
| | + | ADD to the file /etc/dovecot/dovecot-sql.conf.ext |
| | + | <nowiki>connect = host=127.0.0.1 dbname=email_accounts user=email password=password |
| | + | default_pass_scheme = MD5 |
| | + | |
| | + | password_query = SELECT CONCAT(mailboxes.local_part,'@',domains.fqdn) as `user`, mailboxes.password AS `password`,'/var/spool/mail/%d/%n' AS `userdb_home`, [YOUR UID] AS `userdb_uid`, [YOUR GID] AS `userdb_gid` FROM `mailboxes`, `domains` WHERE mailboxes.local_part = '%n' AND mailboxes.active = 1 AND mailboxes.domain_id = domains.id AND domains.fqdn = '%d' AND domains.active = 1 |
| | + | |
| | + | user_query = SELECT '/var/spool/mail/%d/%n' AS `home`, [YOUR UID] AS `uid`, [YOUR GID] AS `gid`</nowiki> |
| | + | |
| | + | === Roundcube === |
| | + | EDIT the file /etc/roundcube/main.inc.php |
| | + | $rcmail_config['default_host'] = '[YOUR MX RECORD]'; |
| | + | |
| | + | Note: replace “[YOUR MX RECORD]” with the MX address you put on your DNS server at the very start. e.g. “mail.my-domain.com”. |
| | + | |
| | + | In that file, there are instructions on how to make it automatically calculate the address using %n, %d, etc. If your MX records for your different domains follow the same pattern (e.g. they are all “mail.my-domain.com”), and your webmail login addresses all follow the same pattern (e.g. “wemail.my-domain.com”), you can put one string here and it will automatically log people into the right server in every case, based on the URL they visited. |
| | + | |
| | + | == Restart Everithing == |
| | + | <nowiki>/etc/init.d/apache2 restart |
| | + | /etc/init.d/exim4 restart |
| | + | /etc/init.d/dovecot restart</nowiki> |
| | + | |
| | + | Exim may output a “paniclog”. If so, read it, fix it – and then manually delete the paniclog file, or else you’ll keep getting fake warnings every time you restart exim. |
| | + | |
| | + | |
| | + | |
| | + | |
| | + | |
| | | | |
| | === STARTTLS === | | === STARTTLS === |