I am not sure if this is the right stack exchange for my question, there are multiple stack exchange were my question might fit.

I have setup my postfix configuration to send my emails through an external SMTP server (the SMTP of my ISP, because they demand so...). But whenever I send an email to an external email adress, it never arrives, I don't receive an error email back either (a 'you are blocked' email or whatever, which I do get if I use my own SMTP server).

Here is my mail.log. I run raspbian, and I have replaced all ip adresses and domain names, just to be sure :p. I sent this test email from squirrelmail, so thats why it says localhost:

Feb  2 16:37:41 raspberrypi postfix/smtpd[1468]: connect from localhost[]
Feb  2 16:37:41 raspberrypi postfix/smtpd[1468]: D7AEEC3940: client=localhost[]
Feb  2 16:37:41 raspberrypi postfix/cleanup[1472]: D7AEEC3940: message-id=<5c79eb3fbc01b4395bc543ebe4d6af0b.squirrel@mydomain.com>
Feb  2 16:37:41 raspberrypi postfix/qmgr[1372]: D7AEEC3940: from=<email@mydomain.com>, size=717, nrcpt=1 (queue active)
Feb  2 16:37:41 raspberrypi postfix/smtpd[1468]: disconnect from localhost[]
Feb  2 16:37:42 raspberrypi postfix/smtp[1473]: D7AEEC3940: to=<externalemail@gmail.com>, relay=smtp.myisp.com[IPmyisp]:587, delay=0.35, delays=0.07/0.01/0.19/0.07, dsn=2.6.0, status=sent (250 2.6.0  <5c79eb3fbc01b4395bc543ebe4d6af0b.squirrel@mydomain.com> Queued mail for delivery)
Feb  2 16:37:42 raspberrypi postfix/qmgr[1372]: D7AEEC3940: removed

My main.cf file from postfix (again replaced some stuff):

smtpd_banner = $myhostname ESMTP $mail_name (Raspbian)
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_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 = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain.com, raspberrypi, localhost.localdomain, localhost
relayhost = [smtp.myisp.com]:587 
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/
mailbox_command =
smtpd_recipient_restrictions =
smtpd_helo_required = yes
smtpd_helo_restrictions =
        check_helo_access hash:/etc/postfix/helo_access
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_CAfile = /etc/ssl/certs/ssl-cert-snakeoil.pem

My /etc/postfix/sasl_passwd is formatted like smtp.myisp.com:587 username:password. Where username and password are the username and password of my ISP.

The SMTP server of my ISP uses TLS and port 587.

I have no idea why the emails aren't arriving, thanks in advance if somebody knows it.

EDIT: if I use an email client for my email account (e.g. outlook) and I enter the SMTP server details of my ISP directly into the client, the email does arrive. But this is not how I would like it to work.

EDIT2: Here is the new log:

Feb  2 19:48:12 raspberrypi postfix/smtps/smtpd[2469]: connect from myhostname[myIP]
Feb  2 19:48:13 raspberrypi postfix/smtps/smtpd[2469]: 76CCBC3ABC: client=myhostname[myIP], sasl_method=PLAIN, sasl_username=username                        
Feb  2 19:48:13 raspberrypi postfix/cleanup[2482]: 76CCBC3ABC: message-id=<tsun0i6rs8hhecmbo6cxrgnv.1454438894036@email.android.com>                                                  
Feb  2 19:48:13 raspberrypi postfix/qmgr[2467]: 76CCBC3ABC: from=<email@mydomain.com>, size=1277, nrcpt=1 (queue active)                                                                 
Feb  2 19:48:13 raspberrypi postfix/smtp[2483]: Untrusted TLS connection established to smtp.myisp.com[IPmyisp]:587: TLSv1 with cipher AES128-SHA (128/128 bits)
Feb  2 19:48:14 raspberrypi postfix/smtp[2483]: 76CCBC3ABC: to=<externalemail@gmail.com>, relay=smtp.myisp.com[IPmyisp]:587, delay=0.58, delays=0.23/0.12/0.16/0.07, dsn=2$ dsn=2.6.0, status=sent (250 2.6.0  <tsun0i6rs8hhecmbo6cxrgnv.1454438894036@email.android.com> Queued mail for delivery)    
Feb  2 19:48:14 raspberrypi postfix/qmgr[2467]: 76CCBC3ABC: removed
  • Please add smtp_tls_loglevel = 1 to your config, reload, and add the log output if you try to send the mail. – tarleb Feb 2 '16 at 18:23
  • @tarleb I added the new log to the post, I don't know if I am supposed to add it this way, but I saw no other way. – mielleman Feb 2 '16 at 19:02
  • it's what I meant, sorry for not being more specific. Thanks for adding the log. Everything looks all right. Which means that I'm out of ideas. Sorry. – tarleb Feb 2 '16 at 19:29

It looks to me like the ISP relay server is misconfigured. It should probably reject your mail right away.

The problem in your config is most likely that postfix isn't authenticating itself to the ISP relay. Set

smtp_sasl_auth_enable = yes

and reload postfix. Then try sending the mail again.

From the postfix doc:

smtp_sasl_auth_enable (default: no)
Enable SASL authentication in the Postfix SMTP client. By default, the Postfix SMTP client uses no authentication.

  • I added your suggestion to the config file and restarted postfix. But it still didn't receive the email and I got almost the same output in the log. Thanks though :) – mielleman Feb 2 '16 at 17:45
  • @mielleman Just noticed your smtp_tls_CAfile parameter. Try commenting that line out. It defines which Certificate Authorities the SMTP client should trust. It's usually ok to use the system default CAs here. A snakeoil cert is most likely not what you want. – tarleb Feb 2 '16 at 17:50
  • I commented it out, but it still didn't work. – mielleman Feb 2 '16 at 18:06
  • @mielleman Ok, one last try: Set myorigin to your domain name example.com or edit /etc/mailname to use just your domain. I still think your ISP relay server is horrible to accept mail without actually sending it. Actually, I believe that it might even be illegal in my jurisdiction. – tarleb Feb 2 '16 at 20:30
  • my domain name was already in '/etc/mailname'. Thanks for trying though. – mielleman Feb 2 '16 at 20:36

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.