/* Here is an example imp_expand_fromaddress function. You get passed
 * the $imp object, and have access to evenything inside it, which
 * should be plenty of information. You can global anything else you
 * need. Return an address - either just the user@ side, or a full
 * address, and it should be used.
 *
 * NB: If users are allowed to change their fromaddresses (not
 * fullnames, though), and they have one set, this will be
 * overridden.
 *
 * NB2: The code assumes that this function will return a reasonable
 * address, so make sure to fall back to $imp->user or some such on
 * failure. */
function imp_expand_fromaddress ($imp) {
  if ($imp->server != 'colrain.williams.edu') { return $imp->user; }
  $cmd = '/usr/local/bin/ph unix=' . escapeShellCmd($imp->user) . ' | /bin/grep email | /usr/bin/awk \'{print $2}\'';
  $name = `$cmd`;
  return (empty($name) ? $imp->user : $name);
} // imp_expand_fromaddress()

