1

I'm trying to send mails with python so I configured a postfix server locally. The python part seems to work as my mails reach the smtpd server. After that, postfix seems to correctly query the MX record and tries to connect the right dns name.

The problem here seems to be that my postfix server never tries port 465, only 25, fails as the port is closed, then give up until the retry timer resets.

Here is my /etc/postfix/main.cf file. I totally know that I'm not fully aware of what I'm doing

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
# Optional, if you want this postfix to use TLS when acting as a client
smtp_use_tls=yes
smtp_tls_security_level = may
smtp_tls_note_starttls_offer = yes

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = yamatetsu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = yamatetsu, localhost.localdomain, , localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost

Again, all I want is to get my python client to send mail to arbitrary destinations, some of which have port 25 closed. The python client seems to connect through port 25, but I would like postfix to figure out how to reach remote servers itself. I do not want to receive mail and I care little about security since everything will be on a single machine behind a NAT.

I'm running ubuntu 14.04 and I installed with apt-get. I also tried to use self generated tls certificates with openssl, but since the line is prefixed with smtpd I'm not sure it is mandatory or not. I'm not even sure how to see if it is correctly parsed or not.

  • If you have limited destination domains - you can use transport maps and specify port for each domain. Of course MTA on destination domain should accept incoming mail on non standard ports - 465, 587, 2525 and so on. – ALex_hha Apr 29 '16 at 8:15
0

Looks like the configuration works, but my ISP is blocking port 25. Best part of it is that they can't seem to do anything about it since they are reselling a cable trunk.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.