rmilter

Crates.iormilter
lib.rsrmilter
version0.2.0
sourcesrc
created_at2020-09-29 18:25:34.330319
updated_at2020-11-24 18:54:02.200975
descriptionA rust-only crate for connecting and using milter functionality.
homepagehttps://github.com/arnej/rmilter
repositoryhttps://github.com/arnej/rmilter.git
max_upload_size
id294219
size53,238
(arnej)

documentation

README

rmilter

rmilter is a Rust crate that allows to connect to MTA services like sendmail or postfix using the milter protocol.

This library uses pure safe Rust code and doesn't require external libraries like libmilter.

Features

  • Connect to MTA services using the milter protocol (IPv4/IPv6 only for now)
  • Define which messages should be transferred
  • Automatically decode base64 and quoted-printable values
  • Uses Rust's type system to prevent misusing the milter protocol

Usage

This crate is on crates.io and can be used by adding rmilter to your dependencies in your project's Cargo.toml.

[dependencies]
rmilter = "0.1"

Example

use rmilter::accept_reject_action::AcceptRejectAction;
use rmilter::message_handler::MessageHandler;
use rmilter::milter_message::MilterProtocol;
use rmilter::milter_builder::MilterBuilder;

struct MyMessageHandler {}

impl MessageHandler for MyMessageHandler {
   fn header(&mut self, name: &str, value: &str) -> AcceptRejectAction {
       println!("name: {}, value: {}", name, value);
       AcceptRejectAction::Continue
   }
}

fn main() {
   let mut handler = MyMessageHandler {};
   let protocol = MilterProtocol::new(false, false, false, false, false, false, false);
   let mut milter = MilterBuilder::new(&mut handler)
       .set_protocol(protocol)
       .build();

   milter
       .run("127.0.0.1:31337")
       .expect("Failed to start milter");
}

Status

rmilter can be used to connect to MTA services and receive messages. It is also possible to easily accept or reject a mail (using AcceptRejectAction).

Currently, functionality for manipulating the mail (add header, recipients and so on) is not yet supported, but will be in a future release.

Commit count: 24

cargo fmt