coocheenin / easymail

Wrapper for the sendmail command. Written in Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EasyMail version badge

EasyMail is a simple wrapper for the sendmail command. It's provides the easiest way for sending emails from your binaries in Nim.

Installation

Install the package by running:

nimble install easymail

Feel free to test the package before writing any code.

Usage

Note: Only with Linux server distro compatible.

# mailme.nim
import easymail

discard mail("youremail@protonmail.com", "NIM Subject", "Hi, It's EasyMail test message!")

You are able to add extra headers:

# mailme.nim
import easymail

extraHeaders.add("Cc: me@mydomain.com")
extraHeaders.add("X-Mailer: EasyMail v0.1.0")

if mail("youremail@protonmail.com", "NIM Subject", "Hi, It's EasyMail test message!", extraHeaders):
  echo "The command completed successfully!"

Here is a fifth parameter emulate, passing with true value will print all generated headers and body without sending attempt:

# mailme.nim
import easymail

discard mail("youremail@protonmail.com", "NIM Subject", "Hi, It's EasyMail test message!", extraHeaders, true)

Testing

Test the package with:

  nimble test

About

Wrapper for the sendmail command. Written in Nim

License:MIT License


Languages

Language:Nim 100.0%