Submitted by yngens on Mon, 08/14/2017 - 05:47
We needed to send notifications to each domain's owner by iterating the following CLI command :
virtualmin notify-domains --domain $dom --body-file /path/file.txt --subject "subject line" from noreply@hostname.tld
and it works fine for top-level domains, but when it comes to sub-domains it gives the error:
No top-level virtual servers selected
Sends email to some or all virtual server owners
virtualmin notify-domains [--domain name]
[--user login]
[--with-feature code]
[--without-feature code]
--body-file /path/to/file.txt | --body-stdin
[--charset cs]
--subject "subject line"
[--from user@domain]
[--admins]
I understand that subdomains belong to main domain's user and so they do not have their own contact e-mails, but then the above command should automatically take the respective top level domain's owner e-mail. Otherwise, it simply doesn't make sense how this command works with subdomains.
We will change our script now to (1) find the top level of each subdomain and then to extract and use it's owner's e-mail, but hopefully this request will be accepted soon and the above command will start working correctly as it is half baked in the current state.
Status:
Active
Comments
Submitted by yngens on Mon, 08/14/2017 - 05:51 Comment #1
Another thought: why to limit options to only
--body-file /path/to/file.txt | --body-stdin
and why not to add
--body-string "string here"
?We needed to notify about changes on each website to their owners and wanted to use $dom (domain name) in the body of the notification message. So for now we generate a file and then use the above format, however it would be very nice to compose the whole message in one line.
Submitted by yngens on Mon, 08/14/2017 - 06:44 Comment #2
I tried all the possible combinations to get parent domain like:
virtualmin list-domains --domain sub.domain.tld --subserver
virtualmin list-domains --domain sub.domain.tld --toplevel
virtualmin list-domains --domain sub.domain.tld --subdomain
virtualmin list-domains --domain sub.domain.tld --parent
virtualmin list-domains --domain sub.domain.tld --parent sub.domain.tld
virtualmin list-domains --parent sub.domain.tld
virtualmin list-domains --subdomain sub.domain.tld
nothing seems to work.
So I had to use:
file=$(virtualmin list-domains --domain $dom --file-only)
parent=$(cat $file | grep backup_parent_dom)
if [ ! -z $parent ]; then
dom=${parent#*=}
fi
echo $dom
which seems pretty crazy.
Submitted by JamieCameron on Tue, 08/15/2017 - 01:04 Comment #3
You're right, the
notify-domains
API command should really support sending email to sub-servers. I'll fix this in the next release.Submitted by JamieCameron on Tue, 08/15/2017 - 01:04 Comment #4
Submitted by IssueBot on Tue, 08/29/2017 - 01:07 Comment #5
Automatically closed - issue fixed for 2 weeks with no activity.
Submitted by yngens on Thu, 04/26/2018 - 03:39 Comment #6
Was this ever really fixed? And if yes, then what about setting the message on the same command line? Why we have to use additional file with
--body-file /path/to/file.txt | --body-stdin
? Why there is no some option like--body-string "string here"
?Submitted by JamieCameron on Fri, 04/27/2018 - 23:00 Comment #7
Because you can't really specify a multi-line email string via a command-line flag.
Submitted by yngens on Sun, 04/29/2018 - 22:01 Comment #8
Please do not ignore the questions: was this ever fixed?
As for your reply, fair enough, however there are lot's of cases when users want to send just short notification message and it would be nice if API could do the same as most of server applications like PHP or bash can send a short e-mails with just one single line without making users to store messages on a separate file.
Submitted by JamieCameron on Sun, 04/29/2018 - 22:20 Comment #9
The original issue of
notify-domains
not sending email to sub-servers is fixed.I'll add a
--body-message
flag in the next release to allow the body to be fully set on the command line.Submitted by yngens on Mon, 04/30/2018 - 22:09 Comment #10
Thanks, Jamie, that's great news!