Nilhcem/FakeSMTP

Emails wont get delivered

Closed this issue · 5 comments

Hello,
I am loving your product so far but when I try to run it under Ubuntu 14.04 LTS, Java 1.7 and Postfix I get the following outputs:
Terminal:

# java -jar /FakeSMTP/target/FakeSMTP-2.1-SNAPSHOT.jar -s -p 2525
INFO  org.subethamail.smtp.server.SMTPServer - SMTP server *:2525 starting
INFO  org.subethamail.smtp.server.ServerThread - SMTP server *:2525 started

FakeSMTP after clicking on start:
AM - SMTP server *:2525 started
and when I send an email to foo@bar.com I get this in the mail.log:

# tail -f /var/log/mail.log
ubuntu postfix/pickup[35673]: 2B7196CF77: uid=33 from=<www-data>
ubuntu postfix/cleanup[35686]: 2B7196CF77: message-id=<56f160ed1e70440caadd89ee11a12d3e@cms.localhost>
ubuntu postfix/qmgr[35674]: 2B7196CF77: from=<www-data@localhost>, size=18731, nrcpt=1 (queue active)
ubuntu postfix/smtp[35689]: connect to bar.com[104.27.139.186]:25: Connection refused
ubuntu postfix/smtp[35689]: connect to bar.com[104.27.138.186]:25: Connection refused
ubuntu postfix/smtp[35689]: 2B7196CF77: to=<foo@bar.com>, relay=none, delay=42, delays=0.08/0.01/42/0, dsn=4.4.1, status=deferred (connect to bar.com[104.27.138.186]:25: Connection refused)

Unfortunately no email will show up in the specified output folder nor does FakeSMTP recognize any incoming email.
Did I miss something?

Vest commented

Hello @MarcJose,

It looks like your email client is trying to send the email to the real server bar.com (port 25), instead of the fake one localhost:2525. How do you send the email?

Kind regards,
Vest

Hello,
thanks for the reply. I am using the standard configuration of postfix and tried to send it via the mail command as well as PHP-mail.

/etc/postfix/master.cf:

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp     inet  n       -       -       -       -       smtpd

/etc/postfix/main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# 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.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost, cms.localhost, ubuntu, localhost.localdomain
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
Vest commented

Hm... I am not a pro in postfix, but the internet says that you probably has to use

smtp_bind_address=66.66.66.66
inet_interfaces=all

where 66.66.66.66 is the IP address of the server, where you run FreeSMTP. Unfortunately I do not know how to change the port :( maybe "host:port" will work.

.... Thanks... I really forgot that command. I am sorry, my fault.

Vest commented

@MarcJose
Good. But what was the proper config setting?