I have two catch all addresses set to forward to a gmail account and today i got a message from my hosting saying that they have blocked port 25 on my vps due to it sending spam out.

how would i only allow emails from something@domain1.com and somethingelse@domain2.com be forwarded to my gmail (how its set up now) but then stop anything else from being sent out so it doesnt get hijacked for sending spam?

I am fairly new to postfix so any help would be appreciated.



the virtual file has:

@domain1.com my_email@gmail.com 
@domain2.com my_email@gmail.com 

and in main.cf:

virtual_alias_domains = domain1.com domain2.com 
virtual_alias_maps = hash:/etc/postfix/virtual 

everything else is standard and not changed from clean install.

this might not be (probably isnt) the best way to do this so any other suggestions are welcome.

update: Thought i had it fixed as i had a few weeks with no issue but then it started up again.

output of postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
message_size_limit = 104857600
mydestination = $myhostname, myhost.net, localhost.myhost.net, , localhost
myhostname = myhost.net
mynetworks = [::ffff:]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_error_sleep_time = 1s
smtpd_hard_error_limit = 20
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_soft_error_limit = 10
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_domains = domain1.com domain2.com
virtual_alias_maps = hash:/etc/postfix/virtual
  • Can you include your postfix configuration for forwarding? – Lucas Ramage Jun 5 at 16:49
  • you need to show output of postconf -n – AlexD Jun 12 at 21:06
  • updated with config – Ste Cox Jun 20 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.