dylandoamaral / zemail

A ZIO wrapper to send Mail using Courier.

Version Matrix


Actions Status codecov Scala Steward badge

A ZIO friendly library to send Email using Courier.

Why use it

  • You need to send emails using ZIO

Using Zemail

The latest version is 0.1.0, which is avaible for scala 2.13.

If you're using sbt, add the following to your build:

libraryDependencies ++= Seq(
  "dev.doamaral" %% "zemail" % "0.1.0"

How it works

Here is a sample to send an email:

import zio.{App, ExitCode}

import zemail.email
import zemail.email.MailerOps

import courier.{Mailer, _}

object Send extends App {
  val envelop = Envelope
    .from("zemail" `@` "gmail.com")
    .to("zinteract" `@` "gmail.com")
    .content(Text("Hi from zemail !"))

  val app = for {
    _ <- email.send(envelop)
  } yield ()

  val builder = Mailer("smtp.gmail.com", 587)
    .as("zemail@gmail.com", "mypassword")

  override def run(args: List[String]): zio.URIO[zio.ZEnv, ExitCode] =