From: Reini U. <ru...@x-...> - 2005-01-30 22:59:26
|
Joel Uckelman schrieb: > 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 would say three constants: EMAIL_HEADER_FROM = "my name" EMAIL_HEADER_REPLY_TO = "my...@em...rver" EMAIL_HEADER_REST = "x-noarchive: yes\nx-sender: phpwiki" > 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?) Nope. Not yet. I added in some code and logic to dump/restore all config.ini setting from a writable config/config.php file for faster loading. This does some detection but it not used per default, since there's no writable config/config.php. Any pecl extension or other lib may define their own EMAIL_HEADER_* constants. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |