Skip to content

question: How to send email on port 465 without using a relay #4136

@ReloadingPeace

Description

@ReloadingPeace

Subject

I would like to contribute to the project

Description

As a novice who came into contact with the mail service for the first time, it was successfully built and run after several days of attempts, and can receive emails

Since the server provider blocked the 25 outbound ports, emails cannot be sent. How to use port 465 to send without using trunking?

Here is my composition.yml configuration

services:
  mailserver:
    image: ghcr.io/docker-mailserver/docker-mailserver:latest
    container_name: mailserver
    # Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
    domainname: mail.example.cn
    env_file: mailserver.env
    # More information about the mail-server ports:
    # https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/
    ports:
      - "25:25"    # SMTP  (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
      - "143:143"  # IMAP4 (explicit TLS => STARTTLS)
      - "465:465"  # ESMTP (implicit TLS)
      - "587:587"  # ESMTP (explicit TLS => STARTTLS)
      - "993:993"  # IMAP4 (implicit TLS)
    volumes:
      - ./docker-data/dms/mail-data/:/var/mail/
      - ./docker-data/dms/mail-state/:/var/mail-state/
      - ./docker-data/dms/mail-logs/:/var/log/mail/
      - ./docker-data/dms/config/:/tmp/docker-mailserver/
      - ./docker-data/dms/custom-certs/:/tmp/dms/custom-certs/:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - SSL_TYPE=manual
      # 值应与容器内的文件路径匹配:
      - SSL_CERT_PATH=/tmp/dms/custom-certs/mail.mail.example.cn.cn_bundle.crt
      - SSL_KEY_PATH=/tmp/dms/custom-certs/mail.mail.example.cn.cn.key
    restart: always
    stop_grace_period: 1m
    # Uncomment if using `ENABLE_FAIL2BAN=1`:
    # cap_add:
    #   - NET_ADMIN
    healthcheck:
      test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
      timeout: 3s
      retries: 0

Here is my postfix-main.cf configuration

smtp_tls_security_level=encrypt
smtp_tls_note_starttls_offer = yes
smtp_tls_wrappermode=yes
smtp_use_tls=yes
smtp_sasl_auth_enable=yes

smtpd_tls_wrappermode = yes
smtpd_tls_auth_only = yes
smtpd_tls_security_level = encrypt

The following is my log

mailserver  | 2024-07-27T00:21:38.471722+08:00 edc3196d5344 postfix/master[731]: warning: process /usr/lib/postfix/sbin/smtp pid 760 exit status 1
mailserver  | 2024-07-27T00:21:38.471733+08:00 edc3196d5344 postfix/master[731]: warning: /usr/lib/postfix/sbin/smtp: bad command startup -- throttling
mailserver  | 2024-07-27T00:21:38.475538+08:00 edc3196d5344 postfix/master[731]: warning: process /usr/lib/postfix/sbin/smtp pid 759 exit status 1
mailserver  | 2024-07-27T00:21:38.475551+08:00 edc3196d5344 postfix/master[731]: warning: /usr/lib/postfix/sbin/smtp: bad command startup -- throttling
mailserver  | 2024-07-27T00:21:42.216939+08:00 edc3196d5344 postfix/submissions/smtpd[790]: warning: hostname 69.159.65.223.static.js.chinamobile.com does not resolve to address <1.2.3.4>: Name or service not known
mailserver  | 2024-07-27T00:21:42.216953+08:00 edc3196d5344 postfix/submissions/smtpd[790]: connect from unknown[<1.2.3.4>]
mailserver  | 2024-07-27T00:21:42.295154+08:00 edc3196d5344 postfix/submissions/smtpd[790]: Anonymous TLS connection established from unknown[<1.2.3.4>]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
mailserver  | 2024-07-27T00:21:42.484028+08:00 edc3196d5344 postfix/submissions/smtpd[790]: 7622E402E9: client=unknown[<1.2.3.4>], sasl_method=LOGIN, [email protected]
mailserver  | 2024-07-27T00:21:42.512886+08:00 edc3196d5344 postfix/sender-cleanup/cleanup[795]: 7622E402E9: message-id=<1333520072.0.1722010903017@[192.168.77.1]>
mailserver  | 2024-07-27T00:21:42.512918+08:00 edc3196d5344 postfix/sender-cleanup/cleanup[795]: 7622E402E9: replace: header MIME-Version: 1.0 from unknown[<1.2.3.4>]; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<192.168.77.1>: MIME-Version: 1.0
mailserver  | 2024-07-27T00:21:42.545104+08:00 edc3196d5344 opendkim[625]: 7622E402E9: DKIM-Signature field added (s=mail, d=mail.example.cn)
mailserver  | 2024-07-27T00:21:42.587866+08:00 edc3196d5344 postfix/qmgr[736]: 7622E402E9: from=<[email protected]>, size=324, nrcpt=1 (queue active)
mailserver  | 2024-07-27T00:21:42.601722+08:00 edc3196d5344 postfix/submissions/smtpd[790]: disconnect from unknown[<1.2.3.4>] ehlo=1 auth=1 mail=1 rcpt=1 data=1 quit=1 commands=6

How can I solve it?
Do you need me to add any configurations, configuration files, or modify any files?
Any answer from you would be of great help to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/questionSomeone asked a question - feel free to answermeta/help wantedThe OP requests help from others - chime in! :Dservice/postfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions