<h2id="set-mail-forwarding-with-sql-command-line">Set mail forwarding with SQL command line</h2>
<p>Let's say you have an existing mail user <code>user@domain.com</code>, and you want to
forward all received emails to another address <code>forward@example.com</code>,
to achieve this, you can login to SQL server and update <code>vmail</code> database like
below:</p>
<pre><code>sql> USE vmail;
sql> UPDATE alias SET goto='forward@example.com' WHERE address='user@domain.com';
</code></pre>
<p>If you want to forward email to multiple destinations, please separate
addresses with comma like below:</p>
<pre><code>sql> UPDATE alias SET goto='forward_1@example.com,forward_2@example.com,forward_3@example.com' WHERE address='user@domain.com';
</code></pre>
<p>To save a copy of forwarded email in mailbox, please add your own email address
as a forwarding destination like below:</p>
<pre><code>sql> UPDATE alias SET goto='user@domain.com,forward_1@example.com' WHERE address='user@domain.com';
</code></pre>
<h2id="related-tutorial">Related tutorial</h2>
<ul>
<li><ahref="./ldap.user.mail.forwarding.html">LDAP: user mail forwarding</a></li>
</ul><divclass="footer">
<pstyle="text-align: center; color: grey;">All documents are available in <ahref="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <ahref="http://creativecommons.org/licenses/by-nd/3.0/us/"target="_blank">Creative Commons</a> license. You can <ahref="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <ahref="http://www.iredmail.org/contact.html">contact us</a> to fix it.</p>