kumomta icon indicating copy to clipboard operation
kumomta copied to clipboard

document `sendmail` executable local submission alternative(s) that are compatible with kumomta

Open jmber opened this issue 1 year ago • 8 comments

What Operating System are you seeing this problem on?

Ubuntu 20.04

What Hardware is this system running?

AMD EPYC

KumoMTA version

2023.12.28-63cde9c7

Did you try the latest release to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version that I tried

Describe the bug

Hi, we want to replace our servers from postfix to kumo. But there is an importing missing feature. PHP mail Function is using under Linux the "sendmail" command to send mails to the local mta.

How it is possible to tell sendmail to use kumo?

To Reproduce

No response

Configuration

default

Expected Behavior

No response

Anything else?

No response

jmber avatar Jan 26 '24 17:01 jmber

More Infos about sendmail and php: https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path

jmber avatar Jan 26 '24 17:01 jmber

We intentionally do not provide a drop-in replacement for the sendmail command.

Injection of mail from the local system can be achieved using other tools that speak SMTP (we like Swaks for ad-hoc CLI injection), or, if you are willing to write a little bit of code, that speak our HTTP REST Injection API.

For PHP, I do not recommend using the mail function if you are operating at any kind of scale. Instead, I would suggest looking at libraries such as PHPMailer and configuring them to talk to the local SMTP port.

wez avatar Jan 26 '24 17:01 wez

Is it fair to assume that what you really want to do is use KumoMTA to send email from PHP? If so, Wez's suggestion above to use PHPMailer is a very good one. if not, please expand on your question.

tommairs avatar Jan 26 '24 23:01 tommairs

Hi, we want to replace postfix by KumoMTA for our server infrastructure. PHP was only an example for the need of sendmail wrapper. We have no influence on the PHP scripts, so the mail() feature cannot be replaced by libraries. cronjob daemon also uses sendmail to send systemmails

jmber avatar Jan 29 '24 15:01 jmber

I found a useful wrapper: https://github.com/sercxanto/small_scripts/blob/master/sendmail_wrapper.py

jmber avatar Jan 29 '24 15:01 jmber

That really just adds a processing layer that eventually just calls the Python SMTP library instead of the PHP one.
It sounds like what you want is the ability to redirect a sendmail call to use KumoMTA with the same parameters instead.

tommairs avatar Jan 29 '24 17:01 tommairs

I found a much simpler alternative to that wrapper in https://stackoverflow.com/a/43146560/149111

Building out a full-fledged drop-in replacement for the sendmail executable isn't on our roadmap at this time. We could be influenced by sponsorship to build it out, but given that it is relatively straightforward to script this functionality, I suspect most folks will look at scripting it for themselves.

wez avatar Jan 29 '24 17:01 wez

I found a stable solution. Called msmtp. More Infos: https://marlam.de/msmtp/msmtp.html

perhaps you can add the hint to the docu.

jmber avatar Jan 30 '24 08:01 jmber