# Can't get email to send?

**URL:** <https://kanboard.discourse.group/t/cant-get-email-to-send/3401>\
**Category:** Open Discussions\
**Created:** [February 27, 2025, 8:50pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401 "2025-02-27T20:50:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [February 27, 2025, 8:50pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/1 "2025-02-27T20:50:38Z")

</div>

With my MAIL\_TRANSPORT set to `mail` in config.php, I see this in the server’s system logs:

```auto
Feb 27 19:57:18 alice php: mail() on [/home/kanboard/libs/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php:34]: To: Kaoru <xxxx@xxxx.co.uk> -- Headers: Message-ID: <9aa858b82b7cfcb14f517e1600bf9b5f@board.xxx.co.uk> Date: Thu, 27 Feb 2025 19:57:18 +0000 From: Jon via Kanboard <kanband-no-reply@xxxx.co.uk> Reply-To: jonathan@xxx.com MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Auto-Submitted: auto-generated -- Subject: [Campaign] New comment on task #10

```

But there is nothing in the server’s mail logs, and nothing arrives. I’m running postfix on Ubuntu using PHP 8.1. Other PHP applications are able to send out mail.

I’ve also tried setting it to sendmail, but can’t see anything either. If I try turning on the debug logs I get loads of stuff but no apparent errors or even any indication that it’s sending any email at all.

Does anyone have any clues about what I might be doing wrong?

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [February 28, 2025, 7:39am UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/2 "2025-02-28T07:39:45Z")

</div>

> [@gilgongo](#):
>
> I’m running postfix…

AFAIK, mail() uses sendmail internally, see default in php.ini:

```plaintext
sendmail_path "/usr/sbin/sendmail -t -i"

```

---

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [February 28, 2025, 8:39am UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/3 "2025-02-28T08:39:43Z")

</div>

Yes, which is also why I’m puzzled about the problem. When I set the kanboard config to use `sendmail` (with the same command that php.ini is using) then mail still doesn’t send. I thought at first it was something to do with with way kanboard was set up to use the php mail function, but that doesn’t seem to be the case if the sendmail option also doesn’t work.

I can try sending directly via smtp auth, but I’d prefer to use the more standard method if I can.

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [February 28, 2025, 5:26pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/4 "2025-02-28T17:26:08Z")

</div>

One more idea: Are you sure that the sender address is accepted by the MTA for delivery? (Relaying)  
Unfortunately, there won’t be any (visible) errors.

---

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [February 28, 2025, 6:57pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/5 "2025-02-28T18:57:07Z")

</div>

I’m pretty sure the relay will accept anything from the server’s IP (which is in the postfix $mynetworks list), regardless of the “From:” header, if that’s what you mean. But to test that, I put the sending address that appears in the logs into a php script using the `mail()` function and all was well with that.

Do you think it might be some issue with SimpleMailInvoker.php that I see kanboard using? Other php systems on the server use PHPMailer.php.

BTW I set the sending address in the kanboard config to “no-reply@” but the log above shows it coming from “kanband-no-reply@”. Not sure that’s a problem though but it’s a bit odd.

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [February 28, 2025, 10:34pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/6 "2025-02-28T22:34:34Z")

</div>

Have you seen this?

> [@Mail function and php version](https://kanboard.discourse.group/t/mail-function-and-php-version/2364):
>
> I recently switched from php 7.4. to php 8.0 (with KB version 1.2.23). I use a shared hosting from Host-Europe. When I use the “Send task by email” function, I get an email where the text contains raw HTML that is not parsed. I found out that the email header contains the FROM: and DATE: twice, e.g. To: "forname surname " \<user@domain.tld\> Subject: TEST Message-ID: \<f7f5a1cc4545ae2c2a88a73f6edf0cf4@assets.domain.tld\> Date: Fri, 09 Sep 2022 12:15:57 +0200 From: via Kanboard \<noreply@domain.tld\>…

---

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [February 28, 2025, 11:09pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/7 "2025-02-28T23:09:09Z")

</div>

Ah! I’ve made that change now, but so far no difference. All other PHP apps show up in our mail server’s log as (for example) `header X-PHP-Originating-Script: 33:PHPMailer.php ...` but Kanboard’s action doesn’t turn up and no mail comes through.

I’ll see if I can play around some more.

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 1, 2025, 1:05pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/8 "2025-03-01T13:05:26Z")

</div>

> [@gilgongo](#):
>
> X-PHP-Originating-Script: 33:PHPMailer.php

I’ve tested it by switching to mail() transport. Mail was delivered with a header:

> X-PHP-Originating-Script: 10316:SimpleMailInvoker.php

BTW, you didn’t mention your Kanboard version in use.

---

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [March 1, 2025, 3:03pm UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/9 "2025-03-01T15:03:10Z")

</div>

So if I use `smtp` it works, but as far as I can tell neither `mail` nor `sendmail` do. It’s OK using `smtp` though, it just means I had to set up an account for it.

Apologies for not mentioning the version I’m using:

Application version: 1.2.43  
PHP version: 8.1.2-1ubuntu2.20  
PHP SAPI: apache2handler  
HTTP Client: cURL  
OS version: Linux 5.15.0-125-generic  
Database driver: sqlite  
Database version: 3.37.2

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 2, 2025, 9:57am UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/10 "2025-03-02T09:57:25Z")

</div>

Even if SMTP transport works, I’d continue searching for the failure with mail().

- Create the following script, name is e.g. mailtest.php.
- Fill the variables with values “xxx” according to the log-line from your initial post.
- Put the script on the server and run it via browser.

```php
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('log_errors','1');
ini_set('display_errors', '1');
ini_set('error_log','php.out');

$to="xxx";

$subject="Sent by mail()";
$body="Lorem ipsum";

$headers = Array(
	"From" => "xxx",
	"Reply-To" => "xxx",
	"Content-Type" => "text/html; charset=utf-8",
	"Content-Transfer-Encoding" => "quoted-printable",
	"Auto-Submitted" => "auto-generated",
);

$extraParams="";

$result = mail($to, $subject, $body, $headers, $extraParams);

var_dump($result);
die("done");

```

---

<div class="post-metadata">

**Author:** ![gilgongo](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/gilgongo/32/2041_2.png) [@gilgongo](https://kanboard.discourse.group/u/gilgongo)\
**Post date:** [March 2, 2025, 10:27am UTC](https://kanboard.discourse.group/t/cant-get-email-to-send/3401/11 "2025-03-02T10:27:52Z")

</div>

Thanks! Yes, that works (it’s essentially a better version of the one I tried on the command line earlier). `mail()` is definitely working on the server.

It may have been me not understanding Kanboard somehow. For example, when I was first testing it I may not have realised it doesn’t send when I comment on a ticket that’s assigned to me (which would be logical). I later found a “send by email” function in the UI which worked after I had set it to `smtp`. I then contacted somebody else who has an account on the board to ask if they had been getting mail and they said they had, but it was only after the change to `smtp`. Hm.

I’ll try changing it back to `mail()` and doing some more reliable tests with them.
