📫 MIME Meta Language
Rust implementation of the Emacs MIME message Meta Language.
Creating a MIME message is boring and non-trivial. Therefore, a library called mml has been defined that parses a language called MML (MIME Meta Language) and generates MIME messages.
From: alice@localhost
To: bob@localhost
Subject: MML simple
<#multipart type=alternative>
This is a plain text part.
<#part type=text/enriched>
<center>This is a centered enriched part</center>
<#/multipart>
compiles to:
Subject: MML simple
To: bob@localhost
From: alice@localhost
MIME-Version: 1.0
Date: Tue, 29 Nov 2022 13:07:01 +0000
Content-Type: multipart/alternative;
boundary="4CV1Cnp7mXkDyvb55i77DcNSkKzB8HJzaIT84qZe"
--4CV1Cnp7mXkDyvb55i77DcNSkKzB8HJzaIT84qZe
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
This is a plain text part.
--4CV1Cnp7mXkDyvb55i77DcNSkKzB8HJzaIT84qZe
Content-Type: text/enriched
Content-Transfer-Encoding: 7bit
<center>This is a centered enriched part</center>
--4CV1Cnp7mXkDyvb55i77DcNSkKzB8HJzaIT84qZe--
Definition
From the Emacs documentation:
The MML language is very simple. It looks a bit like an SGML application, but it’s not.
The main concept of MML is the part. Each part can be of a different type or use a different charset. The way to delineate a part is with a ‘<#part ...>’ tag. Multipart parts can be introduced with the ‘<#multipart ...>’ tag. Parts are ended by the ‘<#/part>’ or ‘<#/multipart>’ tags. Parts started with the ‘<#part ...>’ tags are also closed by the next open tag.
[…]
Each tag can contain zero or more parameters on the form ‘parameter=value’. The values may be enclosed in quotation marks, but that’s not necessary unless the value contains white space. So ‘filename=/home/user/#hello$^yes’ is perfectly valid.
Features
- Compile MML message into MIME message using
MmlCompiler
builder (requires cargo featurecompiler
activated by default) - Interpret MIME message as MML message using the
MimeInterpreter
builder (requires cargo featureinterpreter
activated by default) - Multiple parts support
<#multipart>…<#/multipart>
- Inline part support
<#part text=mime/type>…<#/part>
- Attachment support
<#part filename=/path/to/attachment.ext>
- PGP support (encrypt, decrypt, sign, verify)
Examples
See ./examples
:
Development
The development environment is managed by Nix. Running nix-shell
will spawn a shell with everything you need to get started with the lib: cargo
, cargo-watch
, rust-bin
, rust-analyzer
, notmuch
…
# Start a Nix shell
# then build the lib
Contributing
If you find a bug that does not exist yet, please send an email at ~soywod/pimalaya@todo.sr.ht.
If you have a question, please send an email at ~soywod/pimalaya@lists.sr.ht.
If you want to propose a feature or fix a bug, please send a patch at ~soywod/pimalaya@lists.sr.ht using git send-email (see this guide on how to configure it).
If you want to subscribe to the mailing list, please send an email at ~soywod/pimalaya+subscribe@lists.sr.ht.
If you want to unsubscribe to the mailing list, please send an email at ~soywod/pimalaya+unsubscribe@lists.sr.ht.
If you want to discuss about the project, feel free to join the Matrix workspace #pimalaya or contact me directly @soywod.
Credits
Special thanks to the nlnet foundation that helped Himalaya to receive financial support from the NGI Assure program of the European Commission in September, 2022.