Packages

Pop3 client to download email (including attachments) from the inbox. Decodes multipart content, quoted-printables, base64 and encoded-words. Uses an Erlang pop3 client with SSL support derived from the epop package.

Current section

Files

Jump to
pop3mail lib pop3mail base64_decoder.ex
Raw

lib/pop3mail/base64_decoder.ex

defmodule Pop3mail.Base64Decoder do
@moduledoc """
Replaceable base64 decoder. Replace with your own implementation via the application config :pop3mail, base64_decoder: <replacement>
After changing the config/config.exs run:
* mix deps.compile --force pop3mail
"""
@base64_decoder Application.compile_env(:pop3mail, :base64_decoder, Pop3mail.Base64Decoder.Standard)
defmodule Standard do
@moduledoc "Standard Elixir base64 decoder"
@doc "Decode base64 encoded text, ignoring carriage returns and linefeeds. Returns binary."
@spec decode!(String.t) :: String.t
def decode!(encoded_text) do
Base.decode64!(encoded_text, ignore: :whitespace)
end
end
@doc "Decode base64 encoded text, ignoring carriage returns and linefeeds. Returns binary."
@spec decode!(String.t) :: String.t
defdelegate decode!(encoded_text), to: @base64_decoder
end