Roundcube Community Forum

 

RoundMail configuration for multiple domain names - identities problem

Started by tatham, August 23, 2007, 09:13:24 AM

Previous topic - Next topic

tatham

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

tatham

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:



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']))

SKaero