Domain or mail account creation error: mailmng-outgoing failed

Created:

2016-11-16 12:48:12 UTC

Modified:

2017-04-26 14:52:42 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Domain or mail account creation error: mailmng-outgoing failed

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 12.0 for Linux

Symptoms

An attempt to create a domain or a mail account under a subscription fails with the following errors:

Error: mailmng-outgoing failed: ERROR:outgoing:domains.subscription_id may not be NULL

Error: mailmng-outgoing failed: ERROR:outgoing:mails.domain_id may not be NULL

or

The command /usr/local/psa/admin/bin/mail_auth_view does not show all the mail accounts.

or

Cannot authorize using mail account with the following error in /var/log/maillog:

authpsa[260371]: No such user 'johndoe@example.com' in mail authorization database

Cause

Missing entries in psa.IpAddressesCollections table for the corresponding domain.

Resolution

  1. Find the affected domain and missing ipCollectionId :

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"SELECT d.name,ds.ipCollectionId,ds.type,ipc.* FROM domains d JOIN DomainServices ds on d.id=ds.dom_id LEFT JOIN IpAddressesCollections ipc on (ds.ipCollectionId = ipc.ipCollectionId ) WHERE ds.type='mail' AND ipc.ipCollectionId is NULL"
  2. Find it's related records:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e "SELECT * FROM DomainServices WHERE dom_id in (SELECT id FROM domains WHERE name='example.com') AND type='mail'"
    +-----+--------+------+--------+---------------+----------------+
    | id | dom_id | type | status | parameters_id | ipCollectionId |
    +-----+--------+------+--------+---------------+----------------+
    | 287 | 227 | mail | 0 | 290 | 1061 |
    +-----+--------+------+--------+---------------+----------------+
  3. Check if the ipCollectionId is present in the psa.IpAddressesCollections table:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e "SELECT * FROM IpAddressesCollections WHERE ipCollectionId=1061"
  4. Check the ipAddressId of the domain:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -e"SELECT ipAddressId FROM IpAddressesCollections WHERE ipCollectionId  in (SELECT ipCollectionId FROM DomainServices WHERE dom_id in (SELECT id FROM domains WHERE name='example.com') AND type='web')"
    +-------------+
    | ipAddressId |
    +-------------+
    | 2 |
    +-------------+
  5. Insert the missing ipCollectionId to the psa.IpAddressesCollections table:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e "insert into IpAddressesCollections values (1061,2)"

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e "SELECT * FROM IpAddressesCollections WHERE ipCollectionId=1061"
    +----------------+-------------+
    | ipCollectionId | ipAddressId |
    +----------------+-------------+
    | 1061 | 2 |
    +----------------+-------------+
  6. Execute the mchk utility to fix mail configuration completely:

    # /usr/local/psa/admin/sbin/mchk --with-spam

If query in Step 1 gives a big number of affected domains, use the attached script to insert missing records at one time:

  • generate list of affected domains as follows:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Nse "SELECT d.name FROM domains d JOIN DomainServices ds on d.id=ds.dom_id LEFT JOIN IpAddressesCollections ipc on (ds.ipCollectionId = ipc.ipCollectionId ) WHERE ds.type='mail' AND ipc.ipCollectionId is NULL" > /root/affected_domains.txt
    
  • download and extract the script:

    # wget https://plesk.zendesk.com/hc/article_attachments/115001962349/kb213371469.zip 
    
    # unzip kb213371469.zip
  • create a backup of psa database to make the changes revertable:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin psa > psa`date +%F_%H.%M`.sql
    
  • execute the script to restore missing entries in psa.IpAddressesCollections table:

    # ./kb213371469.sh /root/affected_domains.txt
    
  • run mchk utility to fix mail configuration completely:

    # /usr/local/psa/admin/sbin/mchk --with-spam
    

Attachments:

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