Docker-mailserver: Unable to connect via email client

Created on 9 Jan 2017  路  31Comments  路  Source: tomav/docker-mailserver

I've added a user, verified it by using the setup.sh script (setup.sh email list).

I'm trying to use Thunderbird and add the account but get a "Thunderbird failed to find the settings for your email account".

Perhaps there is a console email client I could potentially use to test this and get a more informative error message?

I've set it up as stated in the wiki here: https://github.com/tomav/docker-mailserver/wiki/FAQ-and-Tips

I've also added the following to my hosts file:

127.0.0.1   domain.com
127.0.0.1   mail.domain.com

I'm using docker-compose with the following configuration:

  mail:
    image: tvial/docker-mailserver:2.1
    hostname: mail
    domainname: domain.com
    container_name: mail
    ports:
    - "25:25"
    - "143:143"
    - "587:587"
    - "993:993"
    volumes:
    - maildata:/var/mail
    - mailstate:/var/mail-state
    - ./config-mail/:/tmp/docker-mailserver/
    environment:
    - ENABLE_SPAMASSASSIN=1
    - ENABLE_CLAMAV=1
    - ENABLE_FAIL2BAN=1
    - ONE_DIR=1
    - DMS_DEBUG=1
    cap_add:
    - NET_ADMIN

volumes:
  maildata:
    driver: local
  mailstate:
    driver: local 

Telnet seems to only work on port 25:
$ telnet localhost 25
```Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail.domain.com ESMTP Postfix (Ubuntu)


**telnet localhost 143**
**telnet localhost 993**
**telnet localhost 587**
(same result for three commands):
```Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
Recreating mail
Attaching to mail
mail    | 
mail    | #
mail    | #
mail    | # ENV
mail    | #
mail    | #
mail    | 
mail    | HOSTNAME=mail
mail    | DMS_DEBUG=1
mail    | ENABLE_CLAMAV=1
mail    | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
mail    | ENABLE_FAIL2BAN=1
mail    | ENABLE_SPAMASSASSIN=1
mail    | PWD=/
mail    | SHLVL=1
mail    | HOME=/root
mail    | ONE_DIR=1
mail    | _=/usr/bin/printenv
mail    | 
mail    | #
mail    | #
mail    | # docker-mailserver
mail    | #
mail    | #
mail    | 
mail    | Initializing setup
mail    |   Registering check,setup,fix,misc and start-daemons functions
mail    |   * _check_environment_variables() registered
mail    |   * _check_hostname() registered
mail    |   * _setup_default_vars() registered
mail    |   * _setup_dovecot() registered
mail    |   * _setup_dovecot_local_user() registered
mail    |   * _setup_dkim() registered
mail    |   * _setup_ssl() registered
mail    |   * _setup_docker_permit() registered
mail    |   * _setup_mailname() registered
mail    |   * _setup_postfix_override_configuration() registered
mail    |   * _setup_postfix_sasl_password() registered
mail    |   * _setup_security_stack() registered
mail    |   * _setup_postfix_aliases() registered
mail    |   * _setup_postfix_vhost() registered
mail    |   * _fix_var_mail_permissions() registered
mail    |   * _misc_save_states() registered
mail    |   * _start_daemons_cron() registered
mail    |   * _start_daemons_rsyslog() registered
mail    |   * _start_daemons_dovecot() registered
mail    |   * _start_daemons_opendkim() registered
mail    |   * _start_daemons_opendmarc() registered
mail    |   * _start_daemons_postfix() registered
mail    |   * _start_daemons_fail2ban() registered
mail    |   * _start_daemons_clamav() registered
mail    |   * _start_daemons_amavis() registered
mail    | Checking configuration
mail    |   Check that there are no conflicts with env variables [_check_environment_variables]
mail    |   Check that hostname/domainname is provided (no default docker hostname) [_check_hostname]
mail    |   * Hostname has been set to mail.domain.com
mail    | Configuring mail server
mail    |   Setting up default variables [_setup_default_vars]
mail    |   * Set ENABLE_LDAP=0
mail    |   * Set ENABLE_FETCHMAIL=0
mail    |   * Set ENABLE_MANAGESIEVE=0
mail    |   * Set DMS_DEBUG=1
mail    |   * Set VIRUSMAILS_DELETE_DELAY=7
mail    |   * Set ENABLE_POP3=0
mail    |   * Set ENABLE_SASLAUTHD=0
mail    |   * Set ENABLE_CLAMAV=1
mail    |   * Set SMTP_ONLY=0
mail    |   * Set ENABLE_FAIL2BAN=1
mail    |   * Set ENABLE_SPAMASSASSIN=1
mail    |   Setting up Dovecot
mail    |   Setting up Dovecot Local User
mail    |   * Checking file line endings
mail    |   * Regenerating postfix user list
mail    |   * user 'chris' for domain 'chris' with password '********'
mail    |   Setting up DKIM
mail    |   * No DKIM key provided. Check the documentation to find how to get your keys.
mail    |   Setting up SSL
mail    |   Setting up PERMIT_DOCKER Option
mail    |   * Adding container ip in my networks
mail    |   Setting up Mailname
mail    |   * Creating /etc/mailname
mail    |   Setting up Postfix Override configuration
mail    |   * No extra postfix settings loaded because optional '/tmp/docker-mailserver/postfix-main.cf' not provided.
mail    |   Setting up Postfix SASL Password
mail    |   * Warning: 'SASL_PASSWD' is not provided. /etc/postfix/sasl_passwd not created.
mail    |   Setting up Security Stack
mail    |   * Enabling and configuring spamassassin
mail    |   * Enabling clamav
mail    |   * Fail2ban enabled
mail    |   Setting up Postfix Aliases
mail    |   * Warning 'config/postfix-virtual.cf' is not provided. No mail alias/forward created.
mail    |   Setting up Postfix vhost
mail    |   Fixing /var/mail permissions
mail    |   * Fixing /var/mail permissions
mail    | Starting Misc
mail    |   * Consolidating all state onto /var/mail-state
mail    |   *   Destination /var/mail-state/spool-postfix exists, linking /var/spool/postfix to it
mail    |   *   Destination /var/mail-state/lib-postfix exists, linking /var/lib/postfix to it
mail    |   *   Destination /var/mail-state/lib-amavis exists, linking /var/lib/amavis to it
mail    |   *   Destination /var/mail-state/lib-clamav exists, linking /var/lib/clamav to it
mail    |   *   Destination /var/mail-state/lib-spamassasin exists, linking /var/lib/spamassasin to it
mail    |   *   Destination /var/mail-state/lib-fail2ban exists, linking /var/lib/fail2ban to it
mail    | Starting mail server
mail    |   Starting cron  [ OK ]
mail    |   Starting rsyslog  [ OK ]
mail    |   Starting dovecot services  [ OK ]
mail    |   Starting opendkim  [ OK ]
mail    |   Starting opendmarc  [ OK ]
mail    |   Starting postfix  [ OK ]
mail    |   Starting fail2ban  [ OK ]
mail    |   Starting clamav  [ OK ]
mail    |   Starting amavis  [ OK ]
mail    | 
mail    | #
mail    | # mail.domain.com is up and running
mail    | #
mail    | 
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Amavis::Conf        2.303
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Archive::Zip        1.30
mail    | Jan  9 12:42:48 mail amavis[1355]: Module BerkeleyDB          0.54
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Compress::Zlib      2.06
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Convert::TNEF       0.18
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Convert::UUlib      1.4
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Crypt::OpenSSL::RSA 0.28
mail    | Jan  9 12:42:48 mail amavis[1355]: Module DB_File             1.827
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Digest::MD5         2.52
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Digest::SHA         5.84_01
mail    | Jan  9 12:42:48 mail amavis[1355]: Module File::Temp          0.23
mail    | Jan  9 12:42:48 mail amavis[1355]: Module IO::Socket::INET6   2.71
mail    | Jan  9 12:42:48 mail amavis[1355]: Module MIME::Entity        5.505
mail    | Jan  9 12:42:48 mail amavis[1355]: Module MIME::Parser        5.505
mail    | Jan  9 12:42:48 mail amavis[1355]: Module MIME::Tools         5.505
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::DKIM::Signer  0.4
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::DKIM::Verifier 0.4
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::Header        2.12
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::Internet      2.12
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::SPF           v2.009
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Mail::SpamAssassin  3.004000
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Net::DNS            0.68
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Net::Server         2.007
mail    | Jan  9 12:42:48 mail amavis[1355]: Module NetAddr::IP         4.071
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Razor2::Client::Version 2.84
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Socket6             0.25
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Time::HiRes         1.9725
mail    | Jan  9 12:42:48 mail amavis[1355]: Module URI                 1.60
mail    | Jan  9 12:42:48 mail amavis[1355]: Module Unix::Syslog        1.1
mail    | Jan  9 12:42:48 mail amavis[1355]: Amavis::DB code      loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: SQL base code        NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: SQL::Log code        NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: SQL::Quarantine      NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Lookup::SQL code     NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Lookup::LDAP code    NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: AM.PDP-in proto code loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: SMTP-in proto code   loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Courier proto code   NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: SMTP-out proto code  loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Pipe-out proto code  NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: BSMTP-out proto code NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Local-out proto code loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: OS_Fingerprint code  NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: ANTI-VIRUS code      loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: ANTI-SPAM code       loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: ANTI-SPAM-EXT code   NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: ANTI-SPAM-C code     NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: ANTI-SPAM-SA code    loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Unpackers code       loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: DKIM code            loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Tools code           NOT loaded
mail    | Jan  9 12:42:48 mail amavis[1355]: Found $file            at /usr/bin/file
mail    | Jan  9 12:42:48 mail amavis[1355]: No $altermime,         not using it
mail    | Jan  9 12:42:48 mail amavis[1355]: Internal decoder for .mail
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .F   
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .Z    at /bin/uncompress
mail    | Jan  9 12:42:48 mail amavis[1355]: Internal decoder for .gz  
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .bz2  at /bin/bzip2 -d
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .xz   tried: xzdec, xz -dc, unxz -c, xzcat
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .lzma tried: lzmadec, xz -dc --format=lzma, lzma -dc, unlzma -c, lzcat, lzmadec
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .lzo  tried: lzop -d
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .rpm  tried: rpm2cpio.pl, rpm2cpio
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .cpio at /bin/pax
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .tar  at /bin/pax
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .deb  tried: ar
mail    | Jan  9 12:42:48 mail amavis[1355]: Internal decoder for .zip 
mail    | Jan  9 12:42:48 mail amavis[1355]: Internal decoder for .kmz 
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .7z   at /usr/bin/7zr
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .rar  tried: unrar-free
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .arj  at /usr/bin/arj
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .arc  tried: nomarch, arc
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .zoo  tried: zoo
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .doc  tried: ripole
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .cab  tried: cabextract
mail    | Jan  9 12:42:48 mail amavis[1355]: No decoder for       .tnef
mail    | Jan  9 12:42:48 mail amavis[1355]: Internal decoder for .tnef
mail    | Jan  9 12:42:48 mail amavis[1355]: Found decoder for    .exe  at /usr/bin/arj
mail    | Jan  9 12:42:48 mail amavis[1355]: Using primary internal av scanner code for ClamAV-clamd
mail    | Jan  9 12:42:48 mail amavis[1355]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
mail    | Jan  9 12:42:48 mail amavis[1355]: Deleting db files snmp.db,__db.002,__db.001,__db.003,nanny.db in /var/lib/amavis/db
mail    | Jan  9 12:42:48 mail amavis[1355]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.54, libdb 5.3
question

All 31 comments

Hi @chrissound, what logs are saying when you try to connect with your email client?

Not too sure which logs I should be looking at? The one in the docker stdout / stderror has no output when trying to connect via the mail client.

The only output occurs when I try port 25:

mail    | Jan  9 14:01:36 mail postfix/smtpd[1398]: warning: connect to Milter service inet:localhost:8891: Connection refused

This line is useful! :-)
Port 8891 is for DKIM. Service is running? You have provided/generated keys?

I don't think I have - I assumed it was optional. Will add this and report back.

mail    |   Setting up DKIM
mail    |   * No DKIM key provided. Check the documentation to find how to get your keys.

Yep, tell me first if DKIM is running.
If running but not working without config, I'll change this warning to an error (with an explicit message)

I've now added them the config file but haven't updated the dns zone - I'm testing this locally and do not have a DNS server (as far as I'm aware).

Is this possible to run just locally?

I've see this in the logs now:

mail    |   Setting up DKIM
mail    |   * DKIM keys added for: chris
mail    |   * Changing permissions on /etc/opendkim

...

mail    | #
mail    | # mail.domain.com is up and running
mail    | #
mail    | 
mail    | Jan  9 14:26:21 mail amavis[1366]: DKIM code            loaded
mail    | Jan  9 14:26:21 mail amavis[1366]: Tools code           NOT loaded
mail    | Jan  9 14:26:21 mail amavis[1366]: Found $file            at /usr/bin/file
mail    | Jan  9 14:26:21 mail amavis[1366]: No $altermime,         not using it
mail    | Jan  9 14:26:21 mail amavis[1366]: Internal decoder for .mail
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .F   
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .Z    at /bin/uncompress
mail    | Jan  9 14:26:21 mail amavis[1366]: Internal decoder for .gz  
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .bz2  at /bin/bzip2 -d
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .xz   tried: xzdec, xz -dc, unxz -c, xzcat
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .lzma tried: lzmadec, xz -dc --format=lzma, lzma -dc, unlzma -c, lzcat, lzmadec
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .lzo  tried: lzop -d
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .rpm  tried: rpm2cpio.pl, rpm2cpio
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .cpio at /bin/pax
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .tar  at /bin/pax
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .deb  tried: ar
mail    | Jan  9 14:26:21 mail amavis[1366]: Internal decoder for .zip 
mail    | Jan  9 14:26:21 mail amavis[1366]: Internal decoder for .kmz 
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .7z   at /usr/bin/7zr
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .rar  tried: unrar-free
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .arj  at /usr/bin/arj
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .arc  tried: nomarch, arc
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .zoo  tried: zoo
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .doc  tried: ripole
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .cab  tried: cabextract
mail    | Jan  9 14:26:21 mail amavis[1366]: No decoder for       .tnef
mail    | Jan  9 14:26:21 mail amavis[1366]: Internal decoder for .tnef
mail    | Jan  9 14:26:21 mail amavis[1366]: Found decoder for    .exe  at /usr/bin/arj
mail    | Jan  9 14:26:21 mail amavis[1366]: Using primary internal av scanner code for ClamAV-clamd
mail    | Jan  9 14:26:21 mail amavis[1366]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
mail    | Jan  9 14:26:21 mail amavis[1366]: Deleting db files snmp.db,__db.002,__db.001,__db.003,nanny.db in /var/lib/amavis/db
mail    | Jan  9 14:26:21 mail amavis[1366]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.54, libdb 5.3

Better, it works now when you connect with your email client?

No I'm still getting the same issue.

[16:37:11] $ docker exec mail ps aux | grep dkim
opendkim  3476  0.0  0.0 108316  2912 ?        Ss    2016   0:00 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid
opendkim  3481  0.0  0.0 419636 13320 ?        Sl    2016   0:44 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid

You have this same output?

opendkim   127  0.0  0.0 108316  2824 ?        Ss   14:26   0:00 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid
opendkim   128  0.0  0.0 345904  7384 ?        Sl   14:26   0:00 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid

Looks the same to me?

Yep, so DKIM is running. What about the logs? Exact same output you had before?

I've just tried change the SMTP port to 25 and get this in the docker output:

mail    | Jan  9 15:43:31 mail postfix/smtpd[1944]: connect from unknown[172.20.0.1]
mail    | Jan  9 15:43:31 mail postfix/smtpd[1944]: warning: TLS library problem: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca:s3_pkt.c:1263:SSL alert number 48:
mail    | Jan  9 15:43:31 mail postfix/smtpd[1944]: lost connection after STARTTLS from unknown[172.20.0.1]
mail    | Jan  9 15:43:31 mail postfix/smtpd[1944]: disconnect from unknown[172.20.0.1]

This is another issue. I think the SSL cipher is unsupported. What is your mail client ?
Thunderbird? Which version?
Could you try with another client?

Yes Thunderbird 45.6, will try another. In the meantime I saw this command in the wiki (and pasting the result as well):
docker exec mail openssl s_client -connect 0.0.0.0:25 -starttls smtp -CApath /etc/ssl/certs/

depth=0 CN = 45d266dde38f
verify return:1
250 DSN
CONNECTED(00000003)
---
Certificate chain
 0 s:/CN=45d266dde38f
   i:/CN=45d266dde38f
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICvjCCAaagAwIBAgIJANvlXLDrAm82MA0GCSqGSIb3DQEBCwUAMBcxFTATBgNV
BAMTDDQ1ZDI2NmRkZTM4ZjAeFw0xNzAxMDUwODI3MDhaFw0yNzAxMDMwODI3MDha
MBcxFTATBgNVBAMTDDQ1ZDI2NmRkZTM4ZjCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAJbVJ1JoAu+WR41E7yzRTqKu04B5Si6lqV3TBU9EldyNhAJrZ5aJ
mFOtmK+Jnvcrdim6sd7NbQzhj0uKSE/PPBVa8BBYZ9ryYqr44uKwRkG6bE54g078
pWvs3vzHZ2qWZ7NvMl9fLqfwbsBnmV/ajtXyybpyr/mlGxSj5xlQk1Egr7/IkY12
RVxQzBU9vcNm4UiAxqw918C+xKIbctmFugkqWHJ75cTA2gMvHlpPvXJ3HdWN+ct8
iiIdHiJGoqKYLMI4f3oMcZHVfDrJNixh24cy5QOKG0B3MGUAa/sgQ49hbtRFwMLu
uUPyvVG7V+nKoZOWARaVCI4nEcgsVyFbbJkCAwEAAaMNMAswCQYDVR0TBAIwADAN
BgkqhkiG9w0BAQsFAAOCAQEAY8qhO2F057HYb7u69+ZsYln8WzDlz3Fnt4Ih6yNy
8gHlHVDlKpBisYOn7k/KduVydsD67UtxehKM0h/OgxQ6wCM6SZGF2sjkd38bV+0G
UuviyOcTsCV/UuoSz2owmaVMZm/3BBZHv7sfYbBvgB0xzTbmPlCs7EWJON4xDSVa
ci3dMIgBr5CEqU/r3M2VrQQsfeL4PqjiASf09Y4agIP43jLt5LMN/xNLGBoPge7c
MtwZxtpp9xBhm4qfXULA6verRj+5YPxAcOb4IH5Z2vi7XtA5SAChZf675E696Y7v
WN7Qclr1EcDcEQkZ/Qp6M7nIf3DqgdGNf6m587GuIU8uaA==
-----END CERTIFICATE-----
subject=/CN=45d266dde38f
issuer=/CN=45d266dde38f
---
No client certificate CA names sent
---
SSL handshake has read 1474 bytes and written 456 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: 3FBA42D300E9C0E1FDC487CB7E7A0E383297751CA4C1334B2AB2773042320D3A
    Session-ID-ctx: 
    Master-Key: DE401BB11A78A6E4FE6943355D27750D1DE2CF5D70879C15C27C19DDD32DCC9C007522DF11662ED201388C9170FAFD57
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1483976831
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

Just installed Thunderbird 45.6.0, was plug and play to retreive and send email.

This certificate is autogenerated?

Not something I've done no - is this required?

Absolutely not required, postfix generated a default certificate, but won't be trusted by your client.
Try disabling SSL on your client.

I've tried this small python script:

import smtplib

server = smtplib.SMTP_SSL("mail.domain.com:587")

server.set_debuglevel(1)
server.login("[email protected]","chris")
server.sendmail("[email protected]", "[email protected]", "test")
server.quit()

With the following output:

Traceback (most recent call last):
  File "index.py", line 3, in <module>
    server = smtplib.SMTP_SSL("mail.domain.com:587")
  File "/usr/lib/python3.6/smtplib.py", line 1029, in __init__
    source_address)
  File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.6/smtplib.py", line 335, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.6/smtplib.py", line 1037, in _get_socket
    server_hostname=self._host)
  File "/usr/lib/python3.6/ssl.py", line 401, in wrap_socket
    _context=self, _session=session)
  File "/usr/lib/python3.6/ssl.py", line 808, in __init__
    self.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.6/ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

Think I may need to set the encryption method though.

Could you try on port 25?

Same result.

I'm also not able to telnet successfully anymore it seems:

telnet mail.domain.com 25
Trying 127.0.0.1...
Connected to mail.domain.com.
Escape character is '^]'.
Connection closed by foreign host.

In your python script, have you changed smtplib.SMTP_SSL to smtplib.SMTP on port 25?
Otherwise it won't work.

What I guess is that you can't use SSL (you don't have a valid certificate).
Try on port 25 disabling SSL.

Note that the test mail may be blocked by Spamassassin.

I've tried that script now with server = smtplib.SMTP("mail.domain.com:25") with same response / result:
smtplib.SMTPServerDisconnected: Connection unexpectedly closed.

I do see this in the logs though:

mail    | Jan  9 16:29:44 mail postfix/qmgr[951]: 8C4F7425548: from=<[email protected]>, size=690, nrcpt=1 (queue active)
mail    | Jan  9 16:30:14 mail postfix/smtp[1376]: connect to mail.domain.com[72.5.54.21]:25: Connection timed out
mail    | Jan  9 16:30:14 mail postfix/smtp[1376]: 8C4F7425548: to=<[email protected]>, orig_to=<amavis>, relay=none, delay=79930, delays=79900/0.02/30/0, dsn=4.4.1, status=deferred (connect to mail.domain.com[72.5.54.21]:25: Connection timed out)

That does not occur again if I run the script again, so perhaps it's not related, no idea what it is (not the email address I used).

I've disabled spam assassin with this line in docker-compose.yml:
- ENABLE_SPAMASSASSIN=0

With same result.

Hi @chrissound, any improvement? How can we help? Any log?

Hi @tomav thanks for all your help. I didn't continue further with this.

Let me know I you need some support. Real time chat is sometimes better.

Was this page helpful?
0 / 5 - 0 ratings