Mail tab for a domain is missing from Plesk: PleskFatalException: domain is not set!

Created:

2016-11-16 13:19:11 UTC

Modified:

2017-08-16 14:13:26 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Mail tab for a domain is missing from Plesk: PleskFatalException: domain is not set!

Applicable to:

  • Plesk for Windows
  • Plesk for Linux

Symptoms

  1. The Mail tab for a domain is missing from Plesk.
  2. Error like the following in Plesk:

    PleskFatalException: domain is not set!
  3. Mail tab exists, however, when clicking it, Plesk shows the following:

     Warning: Permission denied

Cause

  1. The subscription was created before the mail server installation. As a result, the service entry is missing from the database.
  2. Database inconsistency.
  3. Mail management functions are not enabled in Plesk.

Resolution

  1. Сheck the option Enable mail management functions in Plesk in Tools & Settings > Mail > Mail Server Settings in the Plesk control panel or try to activate mail service for the domain by command-line as follows:

for Linux:

    # /usr/local/psa/bin/domain --update example.com -mail_service true
# /usr/local/psa/bin/domain --info example.com | grep 'Mail service'
Mail service: On

for Windows:

    "%plesk_dir%\\bin\\domain" --update example.com -mail_service true
"%plesk_dir%\\bin\\domain" --info example.com | findstr /C:"Mail service"
Mail service: On
  1. If this did not help, use the steps below:

    Automatic recovery (Linux)

    • Download this script for Linux

      # wget https://support.plesk.com/hc/article_attachments/115004385649/mail_restore_lin.zip
      # unzip mail_restore_lin.zip
    • Make it executable:

      # chmod +x ./mail_restore.sh
    • Run the script with a domain name as an argument:

      # ./mail_restore.sh example.com

    Automatic recovery (Windows)

      • Download and unpack this script for Windows

      • Run the script with a domain name as an argument in PowerShell:

        .\\mail_restore.ps1 example.com
      • 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

    Manual recovery (Linux and Windows)

    1. Log in to the Plesk database

    2. Run the following queries, having replaced the domain name with a valid one:

      mysql> SELECT @ID:=max(id)+1 FROM psa.Parameters;
      +----------------+
      | @ID:=max(id)+1 |
      +----------------+
      | 6 |
      +----------------+

      mysql> INSERT INTO psa.Parameters VALUES (@ID,'mailProviderInstanceId','');

      mysql> INSERT INTO psa.Parameters VALUES (@ID,'mailProviderType','local');

      mysql> INSERT INTO psa.Parameters VALUES (@ID,'mailProviderUid','local');

      mysql> INSERT INTO psa.Parameters VALUES (@ID,'nonexist_mail','reject');

      mysql> SELECT @IPID:=max(id)+1 FROM psa.IpCollections;
      +------------------+
      | @IPID:=max(id)+1 |
      +------------------+
      | 11 |
      +------------------+

      mysql> INSERT INTO psa.IpCollections VALUES (@IPID);

      mysql> SELECT @DOMID:=d.id,@IP:=ip.ipAddressId
      FROM psa.domains d JOIN psa.DomainServices ds ON d.id=ds.dom_id
      JOIN psa.IpAddressesCollections ip ON ds.ipCollectionId=ip.ipCollectionId
      WHERE d.name='example.com';
      +--------------+---------------------+
      | @DOMID:=d.id | @IP:=ip.ipAddressId |
      +--------------+---------------------+
      | 1 | 1 |
      +--------------+---------------------+

      mysql> INSERT INTO psa.IpAddressesCollections VALUES (@IPID, @IP);

      mysql> INSERT INTO psa.DomainServices (dom_id,type,status,parameters_id,ipCollectionId) values (@DOMID,'mail',0,@ID,@IPID);

      Note: replace example.com in the query to the corresponding domain name.

Additional information

#213920885 - Some buttons are absent in Plesk or interface is changed

Attachments:

Have more questions? Submit a request
Please sign in to leave a comment.