Author Topic: login via email format with 2 separated domain and mailboxes  (Read 2310 times)

Offline Gamecock

  • Newbie
  • *
  • Posts: 1
login via email format with 2 separated domain and mailboxes
« on: September 17, 2018, 11:17:27 AM »
Hi,
1st question:
How to login to RoundcubeWebmail in email format instead of username? (e.g. info@example.com)

2nd question:
I have 2 domains connected to my VPS. (e.g. example1.com , example2.com)
How to send and receive email (and also login) via two separated mailboxes and hostnames ?

I use Bind9 for my DNS server and use Postfix/Dovecot for email server.

My named config files:

named.conf.local file:

zone "example1.com" {
        type master;
        file "/etc/bind/db.example1.com";
};

zone "example2.com" {
        type master;
        file "/etc/bind/db.example2.com";
};

zone "190.56.135.in-addr.arpa" {
        type master;
        file "/etc/bind/db.179";
};


db.example1.com file:

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.example1.com. root.example1.com. (
                              2         ; Serial
                        86400           ; Refresh
                          7200          ; Retry
                        2419200         ; Expire
                         7200  )        ; Negative Cache TTL
;
@       IN      NS      ns1.example1.com.
@       IN      NS      ns2.example1.com.
@       IN      A       135.56.190.179
ns1     IN      A       135.56.190.179
ns2     IN      A       135.56.190.179
@       IN      MX 0    mail.example1.com.
mail    IN      A       135.56.190.179
www     IN      A       135.56.190.179


db.example2.com file:

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.example1.com. root.example2.com. (
                              2         ; Serial
                        86400           ; Refresh
                          7200          ; Retry
                        2419200         ; Expire
                         7200  )        ; Negative Cache TTL
;
@       IN      NS      ns1.example1.com.
@       IN      NS      ns2.example1.com.
@       IN      A       135.56.190.179
ns1     IN      A       135.56.190.179
ns2     IN      A       135.56.190.179
@       IN      MX 0    mail.example2.com.
mail    IN      A       135.56.190.179
www     IN      A       135.56.190.179




db.example2.com file:

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.example1.com. root.example2.com. (
                              2         ; Serial
                        86400           ; Refresh
                          7200          ; Retry
                        2419200         ; Expire
                         7200  )        ; Negative Cache TTL
;
@       IN      NS      ns1.example1.com.
@       IN      NS      ns2.example1.com.
@       IN      A       135.56.190.179
ns1     IN      A       135.56.190.179
ns2     IN      A       135.56.190.179
@       IN      MX 0    mail.example2.com.
mail    IN      A       135.56.190.179
www     IN      A       135.56.190.179




db.179 file:

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.example1.com. root.example1.com. (
                              2         ; Serial
                         86400          ; Refresh
                          7200          ; Retry
                        2419200         ; Expire
                         7200  )        ; Negative Cache TTL
;
@       IN      NS      ns1.example1.com.
@       IN      NS      ns2.example1.com.
179     IN      PTR     ns1example1.com.



Note: In addition to separate domains, I also want the hostnames to be different.
e.g.:
info@example1.com => mail.example1.com
info@example2.com => mail.example2.com

I have read some documentation but I really confused because I'm new in mail server configurating.

OS: Ubuntu 18.04 LTS x86-64
Web Server: NGINX
PHP Version: 7.2

Thank for your guides.
Regard
« Last Edit: September 17, 2018, 11:21:11 AM by Gamecock »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: login via email format with 2 separated domain and mailboxes
« Reply #1 on: September 18, 2018, 03:09:00 AM »
Quote
How to login to RoundcubeWebmail in email format instead of username? (e.g. info@example.com)

The format of the username is defined by your IMAP server. Roundcube can do nothing about that. But Roundcube ships with some plugins which might help. One of virtuser_file or virtuser_query can be used to do lookups based on what the user enters in the username box and translate it into what the IMAP server expects.

Quote
How to send and receive email (and also login) via two separated mailboxes and hostnames ?

Have a read through the config file. The `default_host` and `smtp_server` optoins support a selection of macros which let you build dynamic values. These options can also be set via a plugin - e.g. as part of the reponse from the virtual user lookup.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦