termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.39k stars 3.09k forks source link

[Package]: sendmail, postfix, qmail, OpenSMTPD or anything else with a mail spool #7633

Open cnst opened 3 years ago

cnst commented 3 years ago

Package description

I'm using some shell scripts in Termux that do some logging, which is then piped directly into mutt to send to my email address using the MX records of the domain name the email is from (pre-configured in ~/.muttrc with set smtp_url = smtp://example.org:25 and set from = android+termux+`whoami`+`hostname`@example.org -- the From: and To: are obviously required, but having to configure smtp_url when it can be deducted automatically by the mail spool software based on the To: email address is not the best user experience).

I've tried looking for sendmail, postfix, qmail, and opensmtpd in packages, but I couldn't find any.

My scripts work great, except if there's no network connectivity. Then mutt simply fails, and, presumably, all logging that was piped to it to be sent over the network, is simply lost. A workaround is possible to log into the file, and then pipe the file to mutt, to be able to re-send the stuff should it fail, but it's more complicated than simply having sendmail, postfix, qmail, opensmtpd, or any other software, handle the mail spooling for you. (Another option might be for mutt to not discard the failed mail that was piped to it, but that would still require extra handling later on to re-send those manually.)

I think it'd be great if a mail spool package were to be available. It should work by default with mutt (unless outgoing smtp port is blocked), and apart from the From: and To: fields in mutt, shouldn't require any extra configuration form the user whatsoever (unless the smtp port is blocked, only then should a user be required to configure the smart-host alternative).

Home page URL

No response

Source code URL

http://man.openbsd.org/sendmail.8

Packaging policy acknowledgement

Additional information

No response

ezbik commented 3 years ago

+1. Any kind of MTA would be very useful in Termux, because of its queue processing feature & retrying delivery logic.

djbarrow commented 3 years ago

Could it be that you are trying to open a tcp port below 1024 for SMTP, this would require your android to be rooted. Try testing with normal linux or raspberrypi.org

ezbik commented 3 years ago

Could it be that you are trying to open a tcp port below 1024 for SMTP

Ofc, it is not the case. He mentioned the situation when outgoing emails can't be delivered because of

no network connectivity.

E.g. in airplane mode, or no signal.

dstecholution commented 2 years ago

Thing to note in current state as of my post; mutt, mailtuils and fetchmail exist. procmail or maildrop is missing.

I've tried looking for sendmail, postfix, qmail, and opensmtpd in packages, but I couldn't find any.

The closest thing to a MTA like sendmail is msmtp.

pkg add -y msmtp

Arch wiki has some good config documentation.

dstecholution commented 2 years ago

Could it be that you are trying to open a tcp port below 1024 for SMTP, this would require your android to be rooted. Try testing with normal linux or raspberrypi.org

the requirement for root user on opening ports below 1024 is at binding the listener not a client calling a socket open.

stokito commented 1 year ago

This looks like something that can be handled by a mutt itself or with a cron that will check maildir outgoing and the call msmtp (e.g. sendmail) to deliver the message. If you have a router nearby then you can install there emailrelay package https://sourceforge.net/p/emailrelay/

And use it as a smarthost

ezbik commented 1 year ago

@stokito it's not useful here, we're discussing a case when the phone is offline, so it has to have a local mail spool, which is processed once the phone gets online.

ChiefMikeK commented 1 year ago

I wonder if com.android.printspooler could be used for this purpose :shipit:

It just sends/broadcasts a file out🌏 after a handshake