项目作者: DockYard

项目描述 :
Build composable mail messages
高级语言: Elixir
项目地址: git://github.com/DockYard/elixir-mail.git
创建时间: 2016-02-09T16:43:15Z
项目社区:https://github.com/DockYard/elixir-mail

开源协议:

下载


Mail

Build Status

An RFC2822 implementation in Elixir, built for composability.

Mail is built and maintained by DockYard, contact us for expert Elixir and Phoenix consulting.

Installation

  1. def deps do
  2. [
  3. # Get from hex
  4. {:mail, "~> 0.4"},
  5. # Or use the latest from master
  6. {:mail, github: "DockYard/elixir-mail"}
  7. ]
  8. end

Building

You can quickly build an RFC2822 spec compliant message.

Single-Part

  1. message =
  2. Mail.build()
  3. |> Mail.put_text("A great message")
  4. |> Mail.put_to("bob@example.com")
  5. |> Mail.put_from("me@example.com")
  6. |> Mail.put_subject("Open me")

Multi-Part

  1. message =
  2. Mail.build_multipart()
  3. |> Mail.put_text("Hello there!")
  4. |> Mail.put_html("<h1>Hello there!</h1>")
  5. |> Mail.put_attachment("path/to/README.md")
  6. |> Mail.put_attachment({"README.md", file_data})

Rendering

After you have built your message you can render it:

  1. rendered_message = Mail.render(message)

Parsing

If you’d like to parse an already rendered message back into
a data model:

  1. %Mail.Message{} = message = Mail.parse(rendered_message)

There are more functions described in the docs

Authors

We are very thankful for the many contributors

Versioning

This library follows Semantic Versioning

Looking for help with your Elixir project?

At DockYard we are ready to help you build your next Elixir project. We have a unique expertise
in Elixir and Phoenix development that is unmatched. Get in touch!

At DockYard we love Elixir! You can read our Elixir blog posts
or come visit us at The Boston Elixir Meetup that we organize.

Want to help?

Please do! We are always looking to improve this library. Please see our
Contribution Guidelines
on how to properly submit issues and pull requests.

DockYard, Inc. © 2015

@dockyard

Licensed under the MIT license