1

Topic: forward email to another address within same domain?

Hi all,

Trying to figure out what mysql command line would be to forward email from one user to another within the same domain=

mysql> USE vmail;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 

I understand to get into the vmail db, but don't quite understand the commands written in the iredmail documentation.

Maybe if someone can write something that I can copy n paste and just change out the email addresses.

Regards

2 (edited by Neutro 2019-06-12 06:59:37)

Re: forward email to another address within same domain?

Hey smile

https://docs.iredmail.org/sql.user.mail.forwarding.html (i put it for other forum members who might find your post later).

The principle behind forwarding is that by default the table "forwardings" contains a column named "address" which is the account mail address" and another column named "forwarding" which is the address to where the emails from this account are forwarded to.

By default the "forwarding" column contains the same address than the account mail address, which translate to "forward mail to original account mail address", which translate to "do not forward mail for this account" wink

So to forward the mail from one account to another, you just have to change the content of the column "forward" from the account you want to forward from and replace the original account mail address by the email address you want to forward to.

So let's take an example and say you wanna forward emails from account john to account anton:

use vmail;

select * from forwardings; (will display the mail accounts content from the 'forwardings' table so you see how it looks)

then we modify the line corresponding to john account to set the column 'forwarding' to anton's address instead:

update forwardings set forwarding='anton@domainname.com' where address='john@domainname.com';

select * from forwardings; (to show if the changes worked)

Then send 1 test email to john and see if anton received it wink

PS: this only works if users are in the same domain. If they are not, follow what's written in the documentation wink