HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   Some hints for Horde IMP with ISPConfig (http://www.howtoforge.com/forums/showthread.php?t=3748)

hastlaug 17th April 2006 06:08

Some hints for Horde IMP with ISPConfig
 
Although this post seems long: Read it - it's (almost) just copy and paste in 2 positions. No big changes. Don't be afraid :)

If you setup Horde IMP as webmailer, you might want to have the sender mail address and the sender name correctly be set.

That's not that easy because you need (non-existing) hook functions retrieving the data. But as I wrote such functions for me, you don't need to do this again ;)

First locate the horde config files.
In horde3/config/prefs.php change the following:

Code:

$_prefs['fullname'] = array(
    'value' => '',
    'locked' => false,
    'shared' => true,
    'type' => 'text',
    'hook' => true,
    'desc' => _("Your full name:")
);

$_prefs['from_addr'] = array(
    'value' => '',
    'locked' => true,
    'shared' => true,
    'type' => 'text',
    'hook' => true,
    'desc' =>  _("Your From: address:")
);

Especially 'hook' has to be true. I suggest setting 'locked' of 'from_addr' to true if you don't want users to be able to modify their from-address.

Then you have to add the following to your horde3/config/hooks.php:

Code:

if (!function_exists('_prefs_hook_from_addr')) {
  function _prefs_hook_from_addr($user=null) {
    $dsn = 'mysql://sqluser:sqlpass@localhost/db_ispconfig';

    if (is_null($user)) {
      $user = Auth::getAuth();
    }

    $db =& DB::connect($dsn, true);
    if (PEAR::isError($db)) {
      return $user;
    }

    $query  = 'SELECT user_email,domain_domain FROM (isp_isp_user INNER JOIN isp_dep ON (isp_isp_user.doc_id=child_doc_id AND isp_isp_user.doctype_id=child_doctype_id))';
    $query .= ' INNER JOIN isp_isp_domain ON (parent_doc_id=isp_isp_domain.doc_id AND parent_doctype_id=isp_isp_domain.doctype_id) WHERE user_username=' . $db->quote($user);
    $result =& $db->query($query);

    if ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
      $return = $row['user_email'] . "@" . $row['domain_domain'];
    } else {
      $return = $query;
    }

    $db->disconnect();

    return $return;
  }
}

if (!function_exists('_prefs_hook_fullname')) {
  function _prefs_hook_fullname($user=null) {
    $dsn = 'mysql://sqluser:sqlpass@localhost/db_ispconfig';

    if (is_null($user)) {
      $user = Auth::getAuth();
    }

    $db =& DB::connect($dsn, true);
    if (PEAR::isError($db)) {
      return $user;
    }

    $query = 'SELECT * FROM isp_isp_user WHERE user_username=' . $db->quote($user);
    $result =& $db->query($query);

    if ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
      $return = $row['user_name'];
    } else {
      $return = $user;
    }

    $db->disconnect();

    return $return;
  }
}

Make sure you replace sqluser by your sql user with sufficient rights to query the ispconfig database and replace sqlpassword by its password. Maybe you also want to replace localhost by the correct sql server and db_ispconfig by the correct sql database. Please note that you have these changes TWO times in the code above.

Done ;)

Cirox 2nd May 2006 23:07

Hi,

thx for your hints.

greetings cirox

SupuS 15th July 2006 12:26

Hi

I have mysql 5 and horde 3.1.2 and your script doesn't work for me as it should .. sql query:

Code:

$query  = 'SELECT user_email,domain_domain FROM (isp_isp_user INNER JOIN isp_dep ON (isp_isp_user.doc_id=child_doc_id AND isp_isp_user.doctype_id=child_doctype_id))';
    $query .= ' INNER JOIN isp_isp_domain ON (parent_doc_id=isp_isp_domain.doc_id AND parent_doctype_id=isp_isp_domain.doctype_id) WHERE user_username=' . $db->quote($user);
    $result =& $db->query($query);

returns 0 rows so if I want to send mail I see this query instead of email adress. :eek:

I'm not so good in sql lang and I am not able to find the thing what can resolve this problem. Any hints please?

Little note: in new version of horde I had to add

Code:

require_once 'DB.php';
before

Code:

$db =& DB::connect($dsn, true);

johnquilmes 28th March 2007 19:19

Horde Groupware Webmail Edition
 
are you probe Horde Groupware Webmail Edition and install with ispconfig??

help my.. please,...!!:confused:

mthalmei 18th July 2007 15:52

Thanks for this great hook.

But unfortunately as already written above this does not seem to be working with recent versions of horde and ispconfig.

I have investigated a little bit and found that by using the table isp_isp_web instead of isp_isp_domain this seems to work.

The code schould look like this:
PHP Code:

$query  'SELECT user_email,web_domain FROM (isp_isp_user INNER JOIN isp_dep ON (isp_isp_user.doc_id=child_doc_id AND isp_isp_user.doctype_id=child_doctype_id))';
$query .= ' INNER JOIN isp_isp_web ON (parent_doc_id=isp_isp_web.doc_id AND parent_doctype_id=isp_isp_web.doctype_id) WHERE user_username=' $db->quote($user);

...

$return $row['user_email'] . "@" $row['web_domain']; 


whitlebitle 14th February 2008 02:15

Is horde works with ISPCONFIG without a problem ?

gorni 26th February 2008 13:58

Yes, Horde Groupware Webmail Edition 1.1 RC2 perfectly works out of the box on ISPConfig 2.2.21. And also does the hooks mentionned above, with Mthalmei's patch...

whitlebitle 27th February 2008 02:03

Thank you!

Where to download it and how to setup it to be like www.domain.com/webmail

like it is with uebimiau direct to domain.com/webmail

And is it possible to be setup without https like it is with packagaes: uebimiau and squirremail?

gorni 27th February 2008 04:10

You may download it from the Horde website at http://www.horde.org.

It just installs like any other PHP/MySQL web application on ISPConfig. Horde specific installation instructions are bundled in the package.

Horde will act like any ISPConfig site: you may or may not activate SSL (https) on it, at your convenience.

whitlebitle 27th February 2008 05:24

Gorni,

Thank you very much.

On additional question: Does 2008-02-15: Horde Groupware Webmail Edition 1.0.5
works great as well on ispconfig ?


All times are GMT +2. The time now is 21:49.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.