From: Joel U. <uck...@no...> - 2005-01-30 21:24:31
|
Thus spake Reini Urban: > Joel Uckelman schrieb: > > Would anyone else besides me find it useful to be able to set certain > > headers (e.g., From, Reply-to) in mail sent by a wiki in that wiki's config > > > file? > > > > Say, in the config file you could have: > > > > EMAIL_HEADER_FROM = MyWiki <my...@ex...> > > EMAIL_HEADER_REPLY_TO = MyWikiAdmin <wik...@ex...> > > EMAIL_HEADER_X_ARBITRARY_JUNK = foo, bar! > > > > and those would be used in all outgoing mail from the wiki. > > Sure. > And we really need a Mailer class, which should produce > all outgoing mails. > But I wanted to defer that to the next release. I have a basic Mailer class hammered out now, and I have a few questions about how we're handling constants. 1. I see that I would need to register nonboolean EMAIL_* constants in IniConfig.php, yes? 2. Which would be preferable: a) EMAIL_HEADER_FROM and EMAIL_HEADER_REPLY_TO contain just the header value, while EMAIL_HEADER_n contains the whole header b) Every header constant contains the whole header, while EMAIL_HEADER_FROM and EMAIL_HEADER_REPLY_TO are named for convenience (rather than numbered) because they'll be the ones people most often want to set. c) Every header constant contains only the header value, and the header name is deduced from the constant name: e.g., when we process the constant EMAIL_HEADER_FROM, we look at the part after EMAIL_HEADER_, lower case it and capitalize the first letter to get the header name. d) Something else, like reading all of the user defined headers from a file. I like c) myself, but I think it would involve a call to get_defined_constants() and then a loop over the whole mess of them just to find the ones which start with EMAIL_HEADER_. That might be unacceptably slow; I'm not sure. (Unless we have a global dictionary which contains all of the variables defined in config.ini? Do we?) |