diff --git a/bin/v-add-mail-domain b/bin/v-add-mail-domain index 43aaac7cd..e765cc4f5 100755 --- a/bin/v-add-mail-domain +++ b/bin/v-add-mail-domain @@ -82,6 +82,14 @@ if [ "$dkim" = 'yes' ]; then record='vmail._domainkey' selector="\"k=rsa\; p=$p\"" $BIN/v-add-dns-record $user $domain $record TXT "$selector" + + if [ "$($BIN/v-list-dns-records $user $domain plain|grep -c '@ MX 10 mx.yandex.ru.')" = "1" ]; then + record='mail._domainkey' + selector=$(host -t TXT mail._domainkey.$domain dns1.yandex.net|grep v\=DKIM1|cut -d\" -f2) + if [ -n "$selector" ]; then + $BIN/v-add-dns-record $user $domain $record TXT "\"$selector\"" + fi + fi fi fi