🍄Nixnet MailSql Snippets

Before running any of these queries, make sure you run <code>USE mailserver;</code> to select the correct database.

Also make a backup before running ''any'' query just in case something goes wrong.

Addresses for RFC 2141 =

<pre>
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'info@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'marketing@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'sales@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'support@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'abuse@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'noc@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'security@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'postmaster@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'hostmaster@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'usenet@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'news@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'webmaster@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'www@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'uucp@example.com', 'john@example.com');
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'ftp@example.com', 'john@example.com');
</pre>

New alias =

<pre>
INSERT INTO virtual_aliases (domain_id, source, destination) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.com'), 'support@example.com', 'john@example.com');
</pre>

New domain =

<pre>
INSERT INTO virtual_domains (name) VALUES ("example.org");
</pre>

New user =

<pre>
INSERT INTO virtual_users (domain_id, email, password) VALUES ( (SELECT id FROM virtual_domains WHERE name='example.net'), 'john@example.net',CONCAT('{SHA256-CRYPT}', ENCRYPT ('insert_password_here', CONCAT('$5$', SUBSTRING(SHA(RAND()), -16)))));
</pre>

Delete user =

<pre>
DELETE FROM virtual_users WHERE email='user@example.com';
</pre>