~whynothugo/xendmail

Sendmail for users
Add timeout to opening connection
Use lexopt for parsing arguments

clone

read-only
https://git.sr.ht/~whynothugo/xendmail
read/write
git@git.sr.ht:~whynothugo/xendmail

You can also use your local clone with git send-email.

#Xendmail: like sendmail, for users

Xendmail is a sendmail drop-in replacement designed to be configured by individual system users to relay email via their preferred email provider.

It was written based on the requirements on the article thoughts on sendmail in 2023. It works for the basic use cases, but hasn't been thoroughly tested beyond that.

#Installation

cargo build --release
doas cp target/release/xendmail /usr/sbin/sendmail

#Configuration

The configuration file is a simple scfg file located in ~/.config/xendmail/default.scfg. It should look something like this:

account hugo@example.com
passcmd hiq -dFpassword proto=smtp hostname=smtp.example.com username=hugo@example.com

account describes an account in an SMTP submission server. It is used for server discovery and authentication. Server discovery is implemented via rfc6186.

account is not used as an envelope-from nor as a From header. The envelope-from will be set to match the value in the From header.

passcmd should be a command (and its arguments). It should print the password in the first line. Anything that it prints after the first \n is discarded.

#Usage

Xendmail reads a messages from standard input (stdin) until it reads an end-of-file. It will then enqueue the message in an smtp server discovered via settings in its configuration file. Configuration is read from $XDG_CONFIG_HOME/xendmail/default.scfg.

If to and from is not provided via the command line, these are read from the email message's fields instead.

In order to maintain compatibility with other implementations of sendmail, various other flags are accepted, but have no effect.

#Known issues

  • The Bcc header is not stripped from messages, and is therefore visible to all recipients. Some MTAs remove the Bcc header themselves, but this may not be true of all MTA implementations. Confirm that yours behaves as expected before using blind carbon copies with xendmail.

#Limitations

  • Submission server is automatically resolved via DNS. If you have an exotic setup and need manual configuration, that is not available yet.
  • Emails are expected to be properly encoded. This means that a header declaring the body's encoding should be present, and non-ascii characters in headers must be encoded using MIME encoded-word syntax.
  • Currently uses STARTTLS by default which is deprecated. Should attempt to use SMTPS by default and only use STARTTLS as a last-resort.

#Security Considerations

The local DNS resolver must be a validating one. DNS entries for email submission discovery must be signed via DNSSEC.

#Todo

#Licence

Copyright 2023 Hugo Osvaldo Barrera

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Do not follow this link