Author Topic: PHP code in $config['default_host'] = '';  (Read 3558 times)

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
PHP code in $config['default_host'] = '';
« on: March 07, 2016, 02:46:09 AM »
Hello again,

Is it possible to use a custom php code in:

Code: [Select]
$config['default_host'] = '';
Like:

Code: [Select]
$config['default_host'] = '$result = dns_get_record("%s", DNS_CNAME);foreach ($result as $record) {echo $record['target'], "\n";}';

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
Re: PHP code in $config['default_host'] = '';
« Reply #1 on: March 07, 2016, 04:13:01 AM »
I dont think you can write PHP like that. I've never seen it at least.

The config files are PHP files though so you can put PHP into them or if you want to keep things a bit tidier use the include_host_config to include a file with your special function.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline ricardo777

  • Jr. Member
  • **
  • Posts: 23
Re: PHP code in $config['default_host'] = '';
« Reply #2 on: March 07, 2016, 07:02:19 AM »
Hello,

Thank you for the reply.

What I want to achieve is that I want to use the mail.domain.com CNAME source as a smtp and imap server. Is it not possible to use your script that you wrote and use the DNS_CNAME target as a host?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
Re: PHP code in $config['default_host'] = '';
« Reply #3 on: March 07, 2016, 11:22:42 AM »
The script that I wrote?

You can put what ever PHP you want in your config file. All I meant was I've never seen assigned like that. I think you should put your code into a function and then assign the result of that function to the var.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…