This works also for different email settings for each domain:
# cat domains.config.php
<?php
if (isset($_SERVER['HTTP_HOST'])) {
switch ($_SERVER['HTTP_HOST']) {
# Server called with cloud.domain1.com
case 'domain1.de':
$CONFIG['mail_from_address'] = '*****';
$CONFIG['mail_domain'] = 'domain1.de';
$CONFIG['mail_smtpname'] = '******';
$CONFIG['mail_smtppassword'] = '******';
break;
case 'domain2.de':
$CONFIG['mail_from_address'] = '*****';
$CONFIG['mail_domain'] = 'domain2.de';
$CONFIG['mail_smtpname'] = '******';
$CONFIG['mail_smtppassword'] = '******';
break;
# and so on for other domains
}
}