0

I have a script that basically connects via telnet to my postfix server and sends email. Of course, it accepts only email when the field "RCPT TO" is like "root@example.com" or "user@example.com". Is there a way to forward all the emails to "root@example.com" even if the RCPT TO field is set like "user@gmail.com" or "user@yahoo.com"?

2 Answers2

2

@Snakethesniper, Since you need a copy of mail for a) mail sent to all valid users and b) mail sent to invalid/non-existent users. I suggest the following.

a) add the following line to your main.cf to get a copy of all valid user mails

always_bcc = root

b) setup the catch-all configuration following the link provided by @Tutul earlier to get a copy of all invalid/non-existent users.

Based what you asked and your follow-up questions, I think you need both settings to accomplish what you are trying to achieve.

Arul Selvan
  • 1,468
0

You can add gmail.com and yahoo.com in postfix mydestination parameter.

Tutul
  • 892
  • can I also send "user@domain.com" email to "root@domain.com" ? – Snakethesniper Jan 24 '15 at 14:44
  • Yes, edit /etc/aliases file and put user:root , then run newaliases command. – Tutul Jan 24 '15 at 14:48
  • thank you very much! Last thing: is it possible to do it even if I don't know the exact username? If I'm not mistaken if there's no "user" on the system it can receive the email right? The idea is to send all the emails to root so that I can see them, even if the user doesn't exist – Snakethesniper Jan 24 '15 at 14:56
  • Sure you can, with catch all address like @domain.com. Here is a good intro http://www.cyberciti.biz/faq/howto-setup-postfix-catch-all-email-accounts/ – Tutul Jan 24 '15 at 15:28