Problem with sending email by using SMTP

Get the image

$ docker pull kanboard/kanboard:v1.2.41
v1.2.41: Pulling from kanboard/kanboard
43c4264eed91: Already exists 
e40041dbcab0: Pull complete 
a96c9dafd763: Pull complete 
f14d806f4719: Pull complete 
175fd4e84c97: Pull complete 
Digest: sha256:b136fc7936a3825124527cc610c55cbde05328bac47a1f06c4854f594090bde5
Status: Downloaded newer image for kanboard/kanboard:v1.2.41
docker.io/kanboard/kanboard:v1.2.41

Prepare file config.php

<?php
// Following two lines from original config.php
defined('ENABLE_URL_REWRITE') or define('ENABLE_URL_REWRITE', true);
defined('LOG_DRIVER') or define('LOG_DRIVER', 'system');

define('PLUGIN_INSTALLER', true);

define('MAIL_TRANSPORT', 'smtp');
// SMTP configuration to use when the "smtp" transport is chosen
define('MAIL_SMTP_HOSTNAME', '********');
define('MAIL_SMTP_PORT', 587);
define('MAIL_SMTP_USERNAME', '********');
define('MAIL_SMTP_PASSWORD', '********');
define('MAIL_SMTP_HELO_NAME', null); // valid: null (default), or FQDN
define('MAIL_SMTP_ENCRYPTION', 'tls'); // Valid values are null (not a string "null"), "ssl" or "tls"

Prepare file compose.yaml

services:
  kanboard:
    image: kanboard/kanboard:v1.2.41
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - kanboard_data:/var/www/app/data
      - kanboard_plugins:/var/www/app/plugins
      - kanboard_ssl:/etc/nginx/ssl
      - type: bind
        source: ./config.php
        target: /var/www/app/config.php
    environment:
      DATABASE_URL: postgres://kanboard:aM9NDmmoH4Y9JHi@db:5432/kanboard
  db:
    image: postgres:latest
    restart: unless-stopped
    environment:
      POSTGRES_DB: kanboard
      POSTGRES_ROOT_PASSWORD: aM9NDmmoH4Y9JHi
      POSTGRES_USER: kanboard
      POSTGRES_PASSWORD: aM9NDmmoH4Y9JHi
volumes:
  kanboard_data:
    driver: local
  kanboard_plugins:
    driver: local
  kanboard_ssl:
    driver: local

Compose and start

$ docker compose up -d
[+] Running 2/2
 ✔ Container docker-db-1        Started                                                                                        0.3s 
 ✔ Container docker-kanboard-1  Started                                                                                        0.3s 

Check Kanboard Version

Define a sender address and verify transport

Define a user address

Send a test task by mail

Mail was successfully sent and received.

Thanks for your reply, Mr.alfredb.
But there’s a more thing I am confused about, if my ‘MAIL_SMTP_USERNAME’ is kanboard@ct-cloud.com.tw, then what should I type in ‘MAIL_SMTP_HOSTNAME’ ? Should the answer be ct-cloud.com.tw?

Yes, the MAIL_SMTP_HOSTNAME is ct-cloud.com.tw

You can use this to check your SMTP server.

Thank. you
I"ve tried. The following is my setting:


And I have sent and received the email successfully.
Does that mean that the SMTP server is OK?
Does that mean that there is no problem in the SMTP server?

1 Like

Yes, seems to work. How is it from the container?

I’ve just sent an email on kanboard v1.2.41, and I find the following error on the debug.log(by executing docker logs kanboard):
螢幕擷取畫面 2024-11-27 031501
What di these error mean?
How to fix them?

The name of the SMTP server doesn’t resolve. You can try the IP address instead.

$ host ct-cloud.com.tw
ct-cloud.com.tw has address 211.21.6.81
ct-cloud.com.tw mail is handled by 10 ct-cloud.com.tw.

Maybe you have also trouble with the proxy settings.

BTW, I,ve tried the commands you have tried in your former post

I’ve tried on both host computer and docker kanboard(by executing docker exec -it kanboard /bin/bash). I got the same consequence on both computer and docker kanboard, and you got the same consequence like me.

So what’s problem on the SMTP server?

What do you want to do on 211.21.6.81?
What should I do?

Please describe more detailedly.

Replace the value of MAIL_SMTP_HOSTNAME (ct-cloud.com.tw) by 211.21.6.81.

No clue. It works from the test page, so …

Maybe it’s not a DNS issue, possibly a timeout.
You can try to increase it in config.php:

define('HTTP_TIMEOUT', 30);

Do you mean define(‘MAIL_SMTP_HOSTNAME’, 211.21.6.81); or define(‘MAIL_SMTP_HOSTNAME’, ‘211.21.6.81’); ?

Does smtp internal code has a variable or constant named HTTP_TIMEOUT ?

It’s a string, so ‘211.21.6.81’ is correct.

Any progress in this matter?