Add timeout to opening connection
Use lexopt for parsing arguments
Formatting
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.
cargo build --release
doas cp target/release/xendmail /usr/sbin/sendmail
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.
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.
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
.The local DNS resolver must be a validating one. DNS entries for email submission discovery must be signed via DNSSEC.
sendmail(8)
.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.