Hello! Some mail servers use a FQDN such as "a-123-bc.example.com". Also, it is often common that users have usernames that are different from their actual e-mail address, which they use to authenticate themselves to the mail server - for example "web78".
When a user on such a mail server uses RoundCube (which by the way is very nice!) without having set up their profile, any mail sent from them will contain an address such as "
[email protected]" in the From header. To prevent this from happening, it would be great if RoundCube requests the user to update his/her profile after the first login. RoundCube uses a MySQL database, so this would definitely be possible. Could this be implemented?
It could be done but it would make a db lager then it is already, and would be a god bit of code So may be on a later version or a plug-in.
Quote from: SKaero It could be done but it would make a db lager then it is already, and would be a god bit of code So may be on a later version or a plug-in.
I don't think you would need to add any tables or fields to the database. You could add something like this to the ./index.php file :
// log in to imap server
if (!empty($_SESSION['user_id']) && $_task=='mail')
{
$DB->query("SELECT * FROM " . get_table_name('identities') . " WHERE user_id='" . $_SESSION['user_id'] ."'");
// $rows = [ Get number of records returned ];
if ( $rows < 1 ) {
$_task = 'settings';
$_action = 'add-identity';
} else {
$conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']);
if (!$conn)
{
show_message('imaperror', 'error');
$_SESSION['user_id'] = '';
}
else
rcmail_set_imap_prop();
}
}
I could be wrong as I haven't really studied the code, but from what I can tell, it would just be a matter of adding those lines. I would implement this in my own installation, but unfortunately I have not been able to figure out yet how to get the number of records returned from the DB query :) Help on that would be appreciated (if it's just a matter of calling a function from the DB class, etc.) ...
Ok, I saw that things were a little more complicated. I realised that a identity is automatically added after first login. I've now used a "quick and dirty" method to force users to check their identities. Am setting a session after the user has entered the identities screen, and I use the following to redirect the user if the session has not been set (./index.php):
// log in to imap server
if (!empty($_SESSION['user_id']) && $_task=='mail') {
$id_updated = isset($_SESSION['id_updated']) ? $_SESSION['id_updated'] : 0;
if ( empty($id_updated) ) {
header( "Location: ./?_task=settings&_action=identities" );
exit;
} else {
$conn = $IMAP->connect($_SESSION['imap_host'], $_SESSION['username'], decrypt_passwd($_SESSION['password']), $_SESSION['imap_port'], $_SESSION['imap_ssl']);
if (!$conn) {
show_message('imaperror', 'error');
$_SESSION['user_id'] = '';
} else {
rcmail_set_imap_prop();
}
}
}
I there can be set a flag 0/1 in the identities table to see if the user has already checked his identity, now you can also force a user to recheck his identity by setting the flag back to zero.
I think this solution should be really simple to implement and does not require a lot of database space.
The identity information is really important, with our current webmail software we get a lot of complains about this!