Packages

Email reply parser for retrieval of the last reply from email message. Originally an Elixir port of https://github.com/github/email_reply_parser as well as its port https://github.com/zapier/email-reply-parser enhanced by e.g. an ability to handle emails with German.

Current section

Files

Jump to
elixir_email_reply_parser lib elixir_email_reply_parser.ex
Raw

lib/elixir_email_reply_parser.ex

defmodule ElixirEmailReplyParser do
@moduledoc """
Main ElixirEmailReplyParser module
"""
@doc false
def read(text) do
ElixirEmailReplyParser.Parser.read(text)
end
@doc ~S"""
Extracts reply from provided email body string
## Parameters
- text: Email body content as a string
## Examples
iex> email_content = "Hi!\n\n How are you?\n__________\nFrom: Some Author\n\n Previous email"
iex> ElixirEmailReplyParser.parse_reply(email_content)
"Hi!\n\n How are you?"
"""
@spec parse_reply(String.t) :: String.t
def parse_reply(text) do
text |> ElixirEmailReplyParser.Parser.read |> ElixirEmailReplyParser.Parser.reply
end
end