muquit / mailsend-go

mailsend-go is a multi-platform command line tool to send mail via SMTP protocol
Other
166 stars 16 forks source link

Drop-in replacement for sendmail / ssmtp #37

Open svenfoo opened 3 years ago

svenfoo commented 3 years ago

I am administering a UNIX system and I'd like it to be able to send mails from cron jobs. Of course I could install a full-fledged MTA, but I'd like to keep things simple. ssmtp seems to be the recommended solution, but I found that it doesn't implement SASL properly and the Postfix server on the other side won't accept mails from ssmtp. Since ssmtp seems unmaintained I started looking for alternatives and came across mailsend-go. I've tested it with my Postfix server and it seems to work nicely.

Unfortunately I can not just use mailsend-go as a drop-in replacement for sendmail, the way that ssmtp allows it. Thus I would like to suggest this as a feature. The mailsend-go binary could provide a sendmail-compatible mode that is activated when called as sendmail. It would then read some configuration like the SMTP server, port, credentials, etc. from a config file and accept the mail the way that sendmail accepts it, with To:, From: Subject:, ... headers followed by the mail body. That way it could be invoked by cron or other system tools that expect a sendmail compatible MTA.

Is that a reasonable feature request? Would there be interest in adding such a feature to mailsend-go? I imagine that it could either be implemented in mailsend-go directly, or there could be a wrapper script that provides the sendmail interface and adapts it to the existing mailsend-go command-line interface.

muquit commented 3 years ago

A script would be much easier to support this feature. I will give it a shot when get some time. Thanks.

svenfoo commented 3 years ago

Thanks for considering my suggestion. In the meantime I found that esmtp provides what I need. I still consider it a good idea to add something similar to mailsend-go though.

gmile commented 3 years ago

@svenfoo out of curiosity, have you considered using msmtp? https://marlam.de/msmtp/

muquit commented 3 years ago

Do you mean to support msmtp's configuration for mailsend-go?

gmile commented 3 years ago

@muquit (in case your question was directed to me) not really, sorry for not being clear. After stumbling upon this GH issue, I did a quick search for other smtp clients out there, found & read about msmtp, and thought it matches @svenfoo's requirements of having a sendmail-compatible tool that'd be based on a config file.