[RCD] Config settings and JS

Thomas Bruederli thomas at roundcube.net
Tue Feb 21 22:56:42 CET 2012

On Tue, Feb 21, 2012 at 22:25, Andy Theuninck <gohanman at gmail.com> wrote:
> I'm trying to tweak roundcubemail to allow recipient addresses without
> a domain - e.g., "billy" instead of "billy at example.com". I'm sure this
> is completely invalid, but postfix and my old webmail will tolerate it
> for local users.

I assume you're not the only one with such a configuration.
> I'd like to do this "correctly" rather than just hack my changes in so
> as to avoid upgrade problems later on (at least as much as possible).
> Adding a config setting to selectively enable the behavior is
> straightforward on the PHP side, but there's also a javascript-based
> validation I need to bypass. Does the project have any standard or
> recommended way for exposing main.inc.php settings to javascript?

The preferred way to pass config options to the client script is
something like this:

$RCMAIL->config->get('smtp_allow_omit_domain', false);

On the client you can access the property with
rcmail.env.allow_omit_domain. For this specific case I'd suggest to
pass the option as an additional argument when calling
rcube_check_email() from with in the rcmail class:

  rcube_check_email('<email>', true, this.env.allow_omit_domain);

I hope this helps...

List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list