Roundcube sends from localhost, junk mail, system account


Verified User
Sep 19, 2014
When creating a new account & login to roundcube using this new account, Roundcube sets the sender to "user@localhost".

I first log with a system account credentials. As compared to virtual host there is no domain in the username. Here if it was a virtual one, the username would be
Screen Shot 2015-08-11 at 13.00.10.png

Since there is no domain in the credentials, roundcube replaces it with "localhost" to build up the address "admin@localhost" as seen below.

Screen Shot 2015-08-11 at 13.03.28.png

Now, if the user decides to send an email, the return-path & From: will be admin@localhost & not The user has to modify his identity in the settings with the right sender email address manually for his emails not to end in junk mail folders.

Received: by with SMTP id c67csp2357512ite;
        Tue, 11 Aug 2015 03:53:39 -0700 (PDT)
X-Received: by with SMTP id f67mr46486774qga.88.1439290419541;
        Tue, 11 Aug 2015 03:53:39 -0700 (PDT)
Return-Path: <admin@localhost>
Received: from ([2604:9a00:XXXX])
        by with ESMTPS id e187si2590284qka.109.2015.
        for <>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 11 Aug 2015 03:53:39 -0700 (PDT)
Received-SPF: neutral ( XXXX is neither permitted nor denied by best guess record for domain of admin@localhost) client-ip=XXXX;
       spf=neutral ( XXXX is neither permitted nor denied by best guess record for domain of admin@localhost) smtp.mailfrom=admin@localhost
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
Content-Transfer-Encoding: 7bit
Date: Tue, 11 Aug 2015 12:53:38 +0200
From: admin <admin@localhost>
Subject: Test
Message-ID: <>
X-Sender: admin@localhost
User-Agent: Roundcube Webmail/1.1.2

The issue does not exist with squirrelmail but squirrelmail looks so much like a webmail from the late nineties so that i would like to use roundcube.

I guess roundcube has no idea how to get the user domain.

Some help for you:

Help will be appreciated considering the settings are taken from


& line

$config['default_host'] = 'localhost';

[h=3]CConfiguring for Virtual Users[/h]Virtual users are useful for hosting providers where a single mailserver is providing email for a number of different domains. The goal is that the user logs in to roundcube with their email login/password, and roundcube knows where to lookup their complete email address. Two options are support, SQL lookups or a sendmail style virtuser file.
Important: Since version 0.4 this requires enabling the appropriate plugins which are virtuser_file and virtuser_query.
In order to test if virtuser is configured correctly, log in to roundcube with a user that does not exist yet. Compose a message, if you see the From address as user@correct_domain, then it worked. If you see user@localhost, something is wrong. To reset and try again, delete that user from the roundcube users table (all related records will be removed using foreign keys cascading).
1) virtuser_file
$rcmail_config['virtuser_file'] = '/etc/mail/virtuser';
This assumes that the file /etc/mail/virtuser contains information about your virtual users in the following format:
user@domain login1
user@domain login2
2) virtuser_query (SQL)
$rcmail_config['virtuser_query'] = "SELECT email_address FROM database.table WHERE login = '%u'";
If you are using postfix and/or some kind of hosting panel, chances are your email accounts are already stored in a SQL table. If that is the case, you want to lookup the emails with a virtuser_query. Virtuser_query plugin also allows to set all identity fields using the query. The parts of the example query:
// email_address - the first column returned by the query must be the complete email address
// database - name of the database where your table is located, the roundcube db user must have read access
// table - name of the table where your email addresses are stored
// login - name of the field that contains the username that is used to log in to roundcube (and send/receive email)
Last edited: