Skip to content

Simple example of how a mailing list can be implemented in Rust.

Notifications You must be signed in to change notification settings

Conzel/mailing-list-rs

Repository files navigation

mailing-list-rs

Simple example of how a mailing list can be implemented in Rust. Uses lettre to deliver mails via a remote SMTP server (for example one as provided by GMail). Supports plaintext, HTML and attachments (all via MIME).

Usage

Either download the binaries for your platforms under releases (Linux and Windows supported) or build them yourself.

The binary is in the form of a Command Line Utility, which can be called with --help for more details. In short: three file paths have to be supplied to the program via command line flags

  • -r or --recipients, a text file in which each line is a valid email address representing one recipient
  • -t or --text-file, a text file which contains the subject and mail text. The subject is on it's own line and is separated from the mail text body with a blank line (or a line containing only three dashes ---). Plaintext files (.txt) and HTML files (.html) are accepted. Non-7-bit ASCII (Umlaute...) don't play nice with plaintext, so use HTML in this case.
  • -c or --config-file, a TOML file containing the configuration information for the mail server. An example for a GMail connection is provided. If this option is left out, the program will search in the directory of the executable for a file called mailsend.toml. The required arguments are:
    • mailserver: Address of the SMTP Server that the mail should be sent to
    • username: Username used to authenticate against the SMTP server
    • password: Password used to authenticate against the SMTP server
    • sender: Mail address appearing in the sender field
    • reply_to: Mail address appearing in the reply_to field

Optionally, attachments can be included using the -a or --attachments flag, followed by a path to a valid file. This option can be specified multiple times, once per attachment.

Example call: ./mailing-list-rs --recipients-file ./example-recipients.txt --text-file ./example-content.txt -config-file ./mailsend.toml --attachments ./example-attachment.txt or shorter ./mailing-list-rs -r ./example-recipients.txt -t ./example-content.txt -c ./mailsend.toml -a ./example-attachment.txt

How to build

  1. Follow the Rust installation instructions in the Rust book
  2. Clone this repository
  3. Navigate into the repository and build the project using cargo build --release
  4. Locate the executable. For example under /path/to/repo/target/release/mailing-list-rs

About

Simple example of how a mailing list can be implemented in Rust.

Resources

Stars

Watchers

Forks

Packages

No packages published