Mail tab for a domain is missing from Plesk: PleskFatalException: domain is not set!
Resolution
1. Log into Plesk UI.
2. Open Plesk > Tools & Settings > Mail > Mail Server Settings and ensure that option Enable mail management functions is on.
Or activate mail service for the domain by command-line while logged in to the server via SSH as follows:
# /usr/local/psa/bin/mail --update-service example.comd -status enabled -ignore-nonexistent-options
# /usr/local/psa/bin/mail --on example.com -ignore-nonexistent-options
# /usr/local/psa/bin/domain --info example.com | grep 'Mail service'
Mail service: On
If this did not help, use the steps below:
Automatic recovery for Linux:
1. Download this script for Linux.
# wget https://support.plesk.com/hc/article_attachments/115004385649/mail_restore_lin.zip
# unzip mail_restore_lin.zip
2. Make it executable:
# chmod +x ./mail_restore.sh
3. Run the script with a domain name as an argument:
# ./mail_restore.sh example.com
4. To restore several domains, execute the command:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -sNe "select d.name from domains d join DomainServices ds on d.id=ds.dom_id where dom_id not in (select dom_id from DomainServices where type='mail')" > domain_list.txt
And then run the script:
# while read dname; do /root/mail_restore.sh $dname; done < domain_list.txt
====================================================================