-1

I have a VPS server LAMP and all it works normaly. But when I try send a email to external server (outlook.com), this error occurs (visible on postfix log):

Jul 23 18:15:00 serv postfix/smtp[1792]: connect to mx3.hotmail.com[65.55.37.104]:25: Connection timed out
Jul 23 18:15:00 serv postfix/smtp[1793]: connect to mx2.hotmail.com[207.46.8.167]:25: Connection timed out

I've tried changing the smtp port in postfix main.cf file I tried to create a route using the file transport and also didn't work. According to my VPS provider the port 25 is blocked and guided me to change. I've read about it in several places and I know that in fact this is the door of communication between SMTP servers, but still I can't change that. Below, the main.cf

# postfix config file
# uncomment for debugging if needed
soft_bounce=yes

# postfix main
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4

# postfix paths
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.2/samples
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES

# network settings
inet_interfaces = all
mydomain   = zpanel
myhostname = zpanel
mynetworks = all
mydestination = localhost.$mydomain, localhost
relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf

# mail delivery
recipient_delimiter = +
# mappings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
transport_maps = hash:/etc/zpanel/configs/postfix/transport
#local_recipient_maps =

# virtual setup
virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf,
                 regexp:/etc/zpanel/configs/postfix/virtual_regexp
virtual_mailbox_base = /var/zpanel/vmail
virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-           virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql- virtual_mailbox_limit_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

# debugging
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5

# authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# tls config
smtp_use_tls = no
smtpd_use_tls = no
#smtp_tls_note_starttls_offer = yes
#smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
#smtpd_tls_session_cache_timeout = 3600s
#tls_random_source = dev:/dev/urandom
#smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
# Change mail.example.com.* to your host name
#smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key
#smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt
# smtpd_tls_CAfile = /etc/pki/tls/root.crt

# rules restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,
    permit_mynetworks,
    reject_unauth_destination,
    reject_non_fqdn_sender,
    reject_non_fqdn_recipient,
    reject_unknown_recipient_domain
# uncomment for realtime black list checks
#       ,reject_rbl_client zen.spamhaus.org
#       ,reject_rbl_client bl.spamcop.net
#       ,reject_rbl_client dnsbl.sorbs.net

smtpd_helo_required = yes
unknown_local_recipient_reject_code = 550
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining
3
  • 1
    Change the port to what? 25 is used between email servers. In the best case you could use the submission port (587) or smtps (465). Also, if you can't change it by altering the postfix configuration, you could try using iptables. Jul 23, 2014 at 22:17
  • 2
    You need a new VPS provider. Jul 23, 2014 at 22:18
  • If outbound connections to 25/tcp are blocked I believe you will have to either configure postfix to use a smarthost or use some other relay server entirely. The recipient servers will (likely) only accept mail om port 25, so it wouldn't help to reconfigure postfix. Jul 23, 2014 at 22:19

1 Answer 1

3

TCP port 25 is the default port for SMTP traffic and is the only accepted way to transmit e-mail over the internet. Postfix is correct in insisting to use that.

Outgoing traffic over port 25 is commonly blocked by consumer ISP's, corporate, government and college networks etc. to prevent their users from transmitting unauthorised e-mail and SPAM.

Generally those ISP's and network operators provide their users with an outgoing SMTP server that enforces the users in those network to comply with local policy. In sendmail jargon that outgoing mailserver is called a smarthost and in Postfix it's commonly called the relayhost.

Ask you ISP for the correct server name and configure something similar in /etc/postfix/main.cf to:

relayhost = smtp.example.com

If you need to provide a username and password to be able to use smtp.example.com take a look at http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html

2
  • Right. I got in contact with the VPS provider to resolve the issue. I am awaiting their response and added the details listed here. As soon as I get the reply, update the question. For now, thank you very much! Jul 24, 2014 at 16:39
  • My VPS provider informed that I can use a relay server. The problem with this method (which even I tested and it worked) is that recipients receive e-mail as being sent from my email gmail.com and not mydomain.com Jul 27, 2014 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .