Author Topic: what is the purpose of the mail_host field of users table?  (Read 4505 times)

Offline boxyball

  • Full Member
  • ***
  • Posts: 92
what is the purpose of the mail_host field of users table?
« on: January 19, 2016, 06:37:19 PM »
I am trying to write a back end interface for multiple domain hosting by reading the users and identities tables.
I see how you use identities table to record each user.
What drives the mail_host field?  Or is it just static based on the default_host field in config.inc.php?
Per the instructions below, why does roundcube care what the hostname of the server is?
It's DNS that sends email to a server's IP regardless of the server's hostname.

// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.


Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: what is the purpose of the mail_host field of users table?
« Reply #1 on: January 20, 2016, 02:26:06 AM »
One Roundcube install can work with different mail server so you could connect a local mail server as well as gmail. If your only connecting to one mail server then it should match what is in the default_host in the config.inc.php.

Offline boxyball

  • Full Member
  • ***
  • Posts: 92
Re: what is the purpose of the mail_host field of users table?
« Reply #2 on: January 20, 2016, 11:00:19 AM »
I am still not understanding. 
The server I am setting up will host multiple different domains for email, yet the users table is only going to have the hostname of the server for all users?  For example, it will have
user1@example1.com and
user2@example2.com
resulting in two entries in the users table but since the server hostname is example1.com, user2 will also have example1.com in the mail_host field.  It would help to know what roundcube is using this field for.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: what is the purpose of the mail_host field of users table?
« Reply #3 on: January 20, 2016, 12:05:55 PM »
the mail_host field is used to make entries in the users table unique.

Say your username for logging into your imap server is "fred" thats not very unique. But there can only be 1 username of "fred" on a single server so if you sort it with the mail_host then its unique.
Because Roundcube can be used to connect to any number of imap servers on a single installation then there could be a user called "fred" on imap.server1.com and another totally different one on "imap.server2.com".

You have an exmaple of user1@example1.com but not all setups use the full email address as the username. some just use the user part.
« Last Edit: January 20, 2016, 12:08:59 PM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline boxyball

  • Full Member
  • ***
  • Posts: 92
Re: what is the purpose of the mail_host field of users table?
« Reply #4 on: January 20, 2016, 08:03:47 PM »
So is this a field that I manually change in the user table if I want roundcube to retrieve email from a different server?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: what is the purpose of the mail_host field of users table?
« Reply #5 on: January 21, 2016, 02:52:54 AM »
no. it its set by roundcube when the user is created, and used later to identify existing users. the actual value comes from your Roundcube config.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…