Roundcube Community Forum

Release Support => Release Discussion => Topic started by: tatham on August 23, 2007, 09:13:24 AM

Title: RoundMail configuration for multiple domain names - identities problem
Post by: tatham on August 23, 2007, 09:13:24 AM
Hi all,

I’ve only had RoundCube running for about an hour now, so excuse any of my n00b stupidity please.

It’s all working now, however the “identities” concept doesn’t seem to work too well for us.

We have about 80 domain names on a mail server, which I have pointed RoundCube at.

All of the accounts use the full email address as the user name. I have set:

   $rcmail_config['default_host'] = 'mail.fueladvance2.com';

With that combination, any of our users could login fine.

However – sending mail doesn’t work until you manually create an identity. This isn’t a great first-run experience, and I don’t want to have to write some sort of script to sync the mail server accounts with the RoundCube identities table.

Is there a simple mod I can make that bypasses this concept of identities and just says “use the username as the from address” ?

I have already configured:

   $rcmail_config['smtp_server'] = 'mail.fueladvance2.com';
   $rcmail_config['smtp_port'] = 25;
   $rcmail_config['smtp_user'] = '%u';
   $rcmail_config['smtp_pass'] = '%p';
   $rcmail_config['smtp_auth_type'] = '';

Any suggestions?

Great so far otherwise! I'm excited about using this product.

 
Thanks,
 
Tatham Oddie
Title: Re: RoundMail configuration for multiple domain names - identities problem
Post by: tatham on August 23, 2007, 09:26:08 PM
Ok everyone - this is the resolution I came up with. It was my first time ever touching PHP, so a bit hackish, but it works.

DIFF:



Code: [Select]
Index: program/steps/mail/sendmail.inc
===================================================================
--- program/steps/mail/sendmail.inc (revision 6556)
+++ program/steps/mail/sendmail.inc (working copy)
@@ -41,26 +41,11 @@
  {
  global $DB, $OUTPUT;
 
- // get identity record
- $sql_result = $DB->query("SELECT *, email AS mailto
-              FROM ".get_table_name('identities')."
-              WHERE identity_id=?
-              AND  user_id=?
-              AND  del<>1&quot;,
-              $id,$_SESSION['user_id']);
-                  
- if ($DB->num_rows($sql_result))
-  {
-  $sql_arr = $DB->fetch_assoc($sql_result);
-  $out = $sql_arr;
-  $name = strpos($sql_arr['name'], &quot;,&quot;) ? '&quot;'.$sql_arr['name'].'&quot;' : $sql_arr['name'];
-  $out['string'] = sprintf('%s <%s>',
-               rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()),
-               $sql_arr['mailto']);
-  return $out;
-  }
-
- return FALSE;
+ $out['string'] = sprintf('%s <%s>',
+               $_SESSION['username'],
+               $_SESSION['username']);
+ return $out;
+
  }
 
 /**
@@ -159,7 +144,7 @@
 $to_address_arr = $IMAP->decode_address_list($mailto);
 $identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST));
 
-$from = $identity_arr['mailto'];
+$from = $_SESSION['username'];
 $first_to = is_array($to_address_arr[0]) ? $to_address_arr[0]['mailto'] : $mailto;
 
 if (empty($identity_arr['string']))
Title: Re: RoundMail configuration for multiple domain names - identities problem
Post by: SKaero on August 23, 2007, 10:16:54 PM
Nice! Thanks for the code! ;)