Quantcast
Channel: Zimbra Forums
Viewing all articles
Browse latest Browse all 1020

Administrators • Is there a way to create a trigger/alert that will notify me when something specific happens in Zimbra?

$
0
0
Here is the situation, I'm the Zimbra Admin, but there are clients with their own Zimbra users who create new domains/email accounts and manage them.

Every time a new domain (with his own email accounts) is added to Zimbra, I need to create a new Zimbra DKIM record (using this: /opt/zimbra/libexec/zmdkimkeyutil -a -d domain.com) for each domain and add it to the DNS zone in the hosting panel. If I don't do that, any email sent from new domains go to spam, especially if they are sent to @gmail. Because as you may know Google in 2024 has new requirements to email senders.

Clients can't do this by their own, so I need to be notified as fast as possible to create the new DKIM records and prevent clients from complaining about mails going to spam.

I made the following script with the idea of creating a cronjob than runs twice per day for example:

Code:

#!/bin/bashreceiver="account@domain.com"subject="A new domain has been created!"# Get current domain listdomains=$(/opt/zimbra/bin/zmprov gad)# Read last stored domains list# This list.txt file includes a list with all the domains, if a new one is created the command output will be compared to that list.domain_list=$(cat /root/list.txt)# Compare if the command output is greater than list.txt contentif [ $(comm -23 <(echo "$domains" | tr ' ' '\n' | sort) <(echo "$domain_list" | tr ' ' '\n' | sort) |>    # If true, the new domain list outputted by the command will be saved in the list.txt    echo "$domains" > /root/list.txt    # Send notification email    message="A new domain has been created!"    echo -e "$message" | mail -s "$subject" "$receiver"fi
That script is just an example of what I want to achieve but "mail" command doesn't work, this is what I get:
Furthermore, I don't think using "mail" will be the answer because emails sent using that command go to spam.

Code:

[root@zimbra ~]# mail -s "Hi" account@domain.comHi againEOT/usr/sbin/sendmail: File or directory doesn't exist"/root/dead.letter" 9/221. . . message not sent.
The previous script is not perfect, so if you know any better or efficient way to do this, I'm open to it!

Statistics: Posted by cmartinez127 — Thu Jan 18, 2024 9:20 am



Viewing all articles
Browse latest Browse all 1020

Trending Articles