YMMW, but I solved this using ssmtp to replace sendmail. According to Arch it may be poor choice, since it is not maintained
https://wiki.archlinux.org/index.php/SSMTP Just my 2 cents Thu, 6 Aug 2020 09:44:24 +0300 skrev Otto Kekäläinen <o...@linux.com>: > Hello! > > Is it possible to send email using the Postfix provided > /usr/sbin/sendmail command on a system where Postfix is installed, but > not running permanently as a service? > > > Background: > > I have a resource constrained system where I want to avoid running > excess processes, and it rarely sends email. When it sends, it just > relays to a proper Postfix host accessible on the local network. There > is no incoming nor local mail delivery needs on that system. > > I have been using msmtp for this need, but its handling of multiple > recipients in the same mail is too simple and I'd rather use Postfix > that parses and validates recipients properly. > > In my testing the command sendmail on a system where Postfix is > installed does accept the email but it puts it in a local queue > (verified by mailq) and then the queue just sits still and no mail is > delivered. Manually running postflush complains that Postfix is not > running. If I quickly cycle 'postfix start' and 'postfix stop' the > service starts and sends out the queue and everything works, but > ideally I'd like an invocation of /usr/sbin/sendmail to immediately > send off the email to the relay host and not depend on a permanently > running Postfix daemon. Is this possible? > > I've tested the -G and -q options mentioned at > http://www.postfix.org/sendmail.1.html but they don't seem to do this > what I was looking for.