Bulk Importing Mail Group Members in Plesk

Plesk 8.3 which is currently in beta lets users import and export Mail Group members, but if you're using an earlier version you can only add one address at a time. If you have a few hundred addresses to add you'll have to do it from MySQL.

MySQL Information

In Plesk the MySQL root user is called admin, and the password will be the Plesk admin password. You'll want to use the psa database.

$ mysql -uadmin -p (plesk_admin_pw) -D psa

Finding the Group ID

The following query will select all of your domains that have Mail Groups and return the group id, domain name, mail name and full group email address

SELECT m.id AS group_id, d.name AS domain_name, m.mail_name,
CONCAT(m.mail_name, '@', d.name) AS group_email
FROM `mail` m LEFT JOIN `domains` d ON m.dom_id = d.id;

Sample output:

+----------+-----------------+-----------+------------------------+
| group_id | domain_name     | mail_name | group_email            |
+----------+-----------------+-----------+------------------------+
|        1 | xxxxx.us        | yyyyyyyy  | yyyyyyyy@xxxxx.us      |
|       22 | abcdefghijk.org | mnbvv     | mnbvv@abcdefghijk.org  |
|       13 | wxyz.org        | qwerty    | qwerty@wxyz.org        |

Adding the Names

Once you have the Group ID, you'll need to build your query in this format:

INSERT INTO `mail_redir` (`mn_id`, `address`) VALUES
(Group_ID, 'user@host.tld');

To add multiple addresses to wxyz.org you would use the following query:

INSERT INTO `mail_redir` (`mn_id`, `address`) VALUES
(13, 'user_123@abc.tld'),
(13, 'user_456@def.tld'),
(13, 'user_789@ghi.tld'),
(13, 'user_012@jkl.tld');

 

Leave a Reply


© 2007-2010, Corey Gilmore | Posts RSS Feed | Comments RSS Feed | Contact

 

The views expressed on these pages are mine alone and not those of any past or present employer. All information presented on this site was obtained lawfully and not through disclosure under the terms of an NDA.