copy inbox and outbox to an external email address.

Hi all.

I have a CentOS based VPS running postfix.

What is the fastest way to copy all the emails that arrive into the inbox/outbox to an external email address?

For an external email address I mean an email that is not managed from my vps.

I need something that when an email is received or sent from one email address managed from my VPS, will be automatically forwarded to another email address that is not managed from my VPS.

Thanks.

5 Replies

If you use postfix, you can add the address to /etc/aliases and /etc/postfix/virtual. There's a certain format to follow, and you'd need to activate these files using the newaliases and postmap commands, then restart postfix, but that'll auto-forward incoming mail to another address.

Another option is to use IMAP from an email such as Gmail. Gmail will connect to your server's IMAP server and retrieve incoming mail.

Neither of these include mail you're sending. I wouldn't know how to take care of that except to use a cron job to copy your mbox or maildir to another machine.

@Piki:

If you use postfix, you can add the address to /etc/aliases and /etc/postfix/virtual. There's a certain format to follow, and you'd need to activate these files using the newaliases and postmap commands, then restart postfix, but that'll auto-forward incoming mail to another address.

Another option is to use IMAP from an email such as Gmail. Gmail will connect to your server's IMAP server and retrieve incoming mail.

Neither of these include mail you're sending. I wouldn't know how to take care of that except to use a cron job to copy your mbox or maildir to another machine.

I don't need to forward but I need to receive the email on two email address, the one managed by my VPS and another external email address.

Any idea on how to copy the sent email or forward it to another email address?

I make the job more easy.

Suppose that I have two email address on the same VPS.

email1@vps.com

and

email2@vps.com

I would like to forward every email from email2@vps.com to email1@vps.com

every email means every received and sent emails.

How can I do that?

Thanks.

@sblantipodi:

I make the job more easy.

Suppose that I have two email address on the same VPS.

email1@vps.com

and

email2@vps.com

I would like to forward every email from email2@vps.com to email1@vps.com

every email means every received and sent emails.

How can I do that?

Thanks.

For the inbox I solved by adding an alias in /ect/aliases like

email2: email2 email1@vps.com

How can I do it for sent email?

senderbccmaps = hash:/etc/postfix/bcc_maps

recipientbccmaps = hash:/etc/postfix/bcc_maps

was the answer.

thanks anyway.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct