[imp] imap/smtp server variable

Cliff Green green@UMDNJ.EDU
Thu, 21 Jun 2001 11:44:13 -0400 (EDT)


On Thu, 21 Jun 2001, Jon Parise wrote:

JP> > So the question is: when does $imp have what I want?  After login.php?
JP> > It certainly has it by the time redirect.php runs.
JP>
JP> $imp will contain values after the session_start() call is
JP> executed in lib/base.php.  It will only contain useful values
JP> after it has been populated by the createSession() function in
JP> lib/IMP.php.
JP>
JP> > If $conf is global, can it be written to, for example in compose.php?
JP> > (No, it didn't work for me.)
JP>
JP> Sure, you can write to it whenever you want, but its contents are
JP> overwritten from the configuration files on every page load.
JP>
JP> > This is the kind of thing that ought to work -- the bits and pieces seem
JP> > to already be here.
JP>
JP> Is there any reason why the knobs in config/servers.php aren't
JP> working for you, instead of munging the variables directly?

servers.php works fine for *retrieving mail*.  There's no (current) way to
set an outbound (smtp/sendmail) setting, though.

So...  (lemmeseenow, where's the $servers hash used?)

Wait.

Note that this is a local hack, and definitely not elegant.

I've inserted the following if clause in message.php and compose.php after
each instance of "include_once 'Mail.php'":

     if ($conf['mailer']['type'] == 'smtp') {
         $conf['mailer']['params']['host'] = $imp['server'];
     }

and it seems to do just what I want (so far): my smtp server setting
follows my imap server setting.

Now to see if a) this lets me use the various aliases the way we want, and
b) how many copies of that clause I can do without.

At first, I thought it would be nice to add an optional value
(smtpserver?) to the $servers hash in login.php and login.inc, and then
test for and use it.  Too much work just now.  Perhaps the test should be
more like:

    if( $conf['mailer']['type'] == 'smtp' &&
       !$conf['mailer']['params']['host'] )

so that, if the smtp host has been set in conf.php, which I don't do now,
this doesn't override it.  I obviously don't care, but it might be
important to someone else.

c
-- 
Clifford Green               Internet -  green@umdnj.edu
Academic Computing Services                    UMDNJ-IST
Okay, that's it.  30 days no computer use penalty for being stupid.