How to mimic `mail` behavior in Rust?

I'm trying to reimplement a collection of hacky bash script into a unified Rust library. The whole process is overall quite straightforward thanks to the amazing ecosystem, since every command the Bash scripts rely onto has (several) corresponding crates offering similar functionalities.

The only exception is mail, from mailutils: despite there being several crates that offer mail creation and sending features, none seem to match mail's behavior, which doesn't require any configuration about how the mail should be sent. In fact, I'm not even sure how mail finds out who to talk to to send the mail.

The mail program delegates sending to sendmail, which is expected to exist as an executable on the system, and is coupled to the active MTA. You can use the sendmail command interface directly by invoking it through std::process::Command.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.