Problem with sending email by using SMTP

I recently installed Kanboard v1.2.41 using Docker on a new server, and then I transferred the data, files, and users from the old server’s Kanboard v1.2.18. The transferred data is saved in two files: kanboard_backup.sql and kanboard_files_backup.tar.gz. I have now imported all the data into the new Kanboard v1.2.41 using these backup files. I want to use the SMTP email feature in Kanboard v1.2.41. Below is an image showing the SMTP settings in my config.php file:

After completing the configuration, I tried sending an email from Kanboard v1.2.41. Although I received the message “Task sent by email successfully,” no emails were received in the inbox. Could you help me identify where the problem might be ?

According to my own working setup.

  • Remove MAIL_SMTP_AUTH, I couldn’t find any reference for this property.
  • Unset MAIL_TRANSPORT and MAIL_BCC.

BTW, to receive such mails, the recipient must

  • be a Kanboard user
  • be a member of the related project
  • have a valid email set in his profile.

EDIT: I just saw that the 2nd point is not a requirement. Sorry.

I’m so sorry, Mr. alfredb, but I’m not sure what you mean by ‘Unset MAIL_TRANSPORT and MAIL_BCC.’ Does this mean I should just comment out these two variables as shown in the figure below? If you don’t mind, could you show me the SMTP configuration from your config.php file?

Also, I have a few questions I’d like to ask:

  1. Could you let me know which version of Kanboard you’re using? If possible, could you share it with me? Is there a possibility that this could be a version compatibility issue?

  2. You mentioned that ‘the recipient must have a valid email set in his profile.’ Are you referring to the email in the ‘Summary’ section of ‘My profile’ in Figure 2? Then, in Figure 3, under Settings → Email Settings, what should I enter for the Email field? (My account in Kanboard is Administrator).

  3. I am currently reviewing the internal SMTP settings, and I will attach the relevant PHP code related to SMTP in my subsequent replies. Could you please help me check if there are any issues?

Let me know if you’d like any adjustments or further help!

Figure 2:


Figure 3:

The following figures are php code about SMTP


Swift_SmtpTransport:

Swift_DependencyContainer:


setHost,setPort and setEncryption:



First, I’ve to state that I’m not a container expert. I tried it once some time ago, just to get in touch with it.

Yes. Usually, I avoid any lines with default values-

Here is my SMTP setup.

To your questions:

  1. I’m’ using version 1.2.42, as well as some of the last recent versions,
    without any problems, BTW.
  2. Correct, this is your personal email as user/administrator.
    At Fig. 3, this emails is used as sender for any mail sent by Kanboard. Use want you want and is accepted by your mail server.
  3. Regarding the SMTP code internals: I think this code wasn’t changed for months or even years. It simply works as expected, and I strongly doubt that there is a problem related to your issue.

As I said, I’m not a docker expert. But out of curiosity, I tried to set up a Kanboard site with docker, including the targeted SMTP mail transport. As expected, mailing via SMTP works like a charm.

This brings me to a possible cause:

AFAIK, you must not deal with config.php. Add your required settings to the docker-compose.yml file, under services > kanboard > environment.

Thank you for your reply, Mr. alfredb. Below is my docker-compose.yml file:

After reading your reply, I have a few more questions:

  1. Since you mentioned that after setting up Kanboard using Docker (version 1.2.42, correct?), you were able to configure SMTP for email sending, could you please provide the system specifications of the computer you used (e.g., operating system, CPU, etc.), and the process you followed to set up Kanboard with Docker? I would like to know all the commands (history) you ran during the setup. You can check the history of commands by running history on the server (terminal), which should show all the commands executed during the installation of Kanboard. Could you please send me a screenshot of those commands along with your docker-compose.yml file?
    (My Kanboard installation process was: First, I ran “docker pull kanboard/kanboard”, then I wrote my own docker-compose.yml file, followed by “docker-compose up -d” to bring up Kanboard. After that, I imported the data, files, and user accounts into Kanboard as shown in the image. For the data, plugins, config.php, and MariaDB, I first placed them on the host machine and then mapped them to the corresponding folders in Docker.)

  2. If I modify the content in the config.php file, do I need to restart Docker using docker restart kanboard or docker-compose restart kanboard?

  3. Kanboard should have logs for email sending. Where would these logs be stored in Docker? If I check these logs, will they show what went wrong with the SMTP email sending?

Regarding

  1. For me, it’s unclear, how you import your data into Kanboard.
  2. According to the docs, yes.
  3. No clue. I only know of the debug.log. You can enable it, Kanboard will report any problem there.

As mentioned earlier, I configure the environment in the docker-compose.yml file.

MAIL_TRANSPORT: smtp
MAIL_SMTP_HOSTNAME: ********
MAIL_SMTP_PORT: 587
MAIL_SMTP_USERNAME: ********
MAIL_SMTP_PASSWORD: ********
MAIL_SMTP_HELO_NAME: null
MAIL_SMTP_ENCRYPTION: tls

Thanks for your reply, Mr.alfredb. Here are my questions:

  1. Below is my current full docker-compose.yml files. Could you show me your full docker-compose.yml file? I would like to know what is difference between your kanboard settings and mine.

  2. I’ve found debug.log file in docker kanboard. I tried to send an email by kanboard via smtp. Kanboard still replied me ‘task sent by email successfully’, but my email hasn’t received any mail yet. The following figure is the error after I send an email by kanboard (in the debug.log file):
    螢幕擷取畫面 2024-11-20 011555

  3. I’ve found a new docker named mailserver. Can we use mailserver to send an email in kanboard. How to combine these two dockers?

  4. My current kanboard version is v 1.2.41. Should I tried these revisions above in the latest version v1.2.42 ?

  5. I don’t know what to do to enable kanboard mail function. Should I revise SMTP code internals? Should I change kanboard to the latest version? Should I add more settings in my docker-compose.yml file?

Well, meanwhile I changed my config, but here is the previous file:

services:
  kanboard:
    image: abu/kbdev:latest
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - kanboard_data:/var/www/app/data
      - kanboard_plugins:/var/www/app/plugins
      - kanboard_ssl:/etc/nginx/ssl
    environment:
      DATABASE_URL: postgres://kanboard:********@db:5432/kanboard
      MAIL_TRANSPORT: smtp
      MAIL_SMTP_HOSTNAME: ********
      MAIL_SMTP_PORT: 587
      MAIL_SMTP_USERNAME: ********
      MAIL_SMTP_PASSWORD: ********
      MAIL_SMTP_HELO_NAME: null
      MAIL_SMTP_ENCRYPTION: tls
  db:
    image: postgres:latest
    restart: unless-stopped
    environment:
      POSTGRES_DB: kanboard
      POSTGRES_ROOT_PASSWORD: ********
      POSTGRES_USER: kanboard
      POSTGRES_PASSWORD: ********
volumes:
  kanboard_data:
    driver: local
  kanboard_plugins:
    driver: local
  kanboard_ssl:
    driver: local

Some remarks:

  • Do you really need this google DNS (8.8.8.8)? I’d remove it, at least until everything works.
  • image: abu/kbdev:latest
    I use my own image, built from kanboard:latest or any other, containing all required plugins.

For the new questions:
2) Make sure, your DNS works.
3) Forget it, unneeded.
4) If you’d like to, but not a requirement.
5) Don’t touch, not required if you use the original Kanboard image.

From the beginning, I had a suspect that your SMTP server didn’t a good job. Now I took a closer look.

First try with email command line client.

Connecting to server ct-cloud.com.tw on port 587
Greeting the SMTP server...                                                                                                         
email: FATAL: Smtp error: Lost connection with SMTP server

Second, try with telnet.

$ telnet ct-cloud.com.tw 587
Trying 211.21.6.81...
Connected to ct-cloud.com.tw.
Escape character is '^]'.
220 ct-cloud.com.tw ESMTP Postfix
EHLO local.domain.name
250-ct-cloud.com.tw
250-PIPELINING
250-SIZE 102400000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 CHUNKING
AUTH PLAIN
503 5.5.1 Error: authentication not enabled
AUTH LOGIN
503 5.5.1 Error: authentication not enabled
AUTH CRAM-MD5
503 5.5.1 Error: authentication not enabled
MAIL FROM: kanboard@ct-cloud.com.tw
250 2.1.0 Ok
RCPT TO:  kanboard@ct-cloud.com.tw
554 5.7.1 <211-21-6-81.hinet-ip.hinet.net[211.21.6.81]>: Client host rejected: Access denied
QUIT                                    
221 2.0.0 Bye
Connection closed by foreign host.
  • No authentication is enabled
    AUTH PLAIN
    503 5.5.1 Error: authentication not enabled
    AUTH LOGIN
    503 5.5.1 Error: authentication not enabled
    AUTH CRAM-MD5
    503 5.5.1 Error: authentication not enabled

  • Server denies any RCPT, even to the sender.
    RCPT TO: kanboard@ct-cloud.com.tw
    554 5.7.1 <211-21-6-81.hinet-ip.hinet.net[211.21.6.81]>: Client host rejected: Access denied

Either fix your SMTP server first, or try with a known working server you have access to.

Thanks for your reply. But what do you mean fix the smtp server? How to fix it?

IMHO, this SMTP server looks misconfigured, there is no auth method enabled, and it doesn’t accept any mail for sending. Unfortunately, I have no experience of configuring postfix. Please ask whoever is responsible for this server.

Would it be helpful for you, if I create and test a container with 1.2.41 image? I’m sure it will work either, unless I’d use your SMTP server.

Thanks for your help , Mr.alfredb. It’ll be really really helpful if you’re willing to demo the process of how to make the mail function work with kanboard version 1.2.41.
If you don’t mind, please show your step detailedly(every command you execute in the server
). Thanks!