GithubHelp home page GithubHelp logo

eximap's Introduction

Eximap

Build Status Hex Version Coverage Status

Eximap is an elixir library that can connect to IMAP servers via TLS and execute commands.

Motivation

We started working with Elixir this year and we wanted to make an internal CRM, but we could not find any library that can connect to an IMAP server and load messages and that can be notified of new messages from the server. All options were in other languages like nodejs, but we since there is a POP3 library in erlang there should be one for IMAP as well.

Roadmap

Completed:

  • open an TLS connection to an IMAP server
  • login using an email account and password (PLAIN AUTH over TLS)
  • Execute commands and return the result as an Elixir structure
  • Format each response as either a map or a structure for easier interaction.

Under development:

  • Handle binary responses

Planned:

  • Handle requests and responses asyncronously

Development

In order to test and develop the library locally you will need an IMAP server. One easy way of getting an IMAP server up and running is with Docker.

Make sure you have Docker installed and that the following ports are open and then run this command:

docker run -d -p 25:25 -p 80:80 -p 443:443 -p 110:110 -p 143:143 -p 465:465 -p 587:587 -p 993:993 -p 995:995 -v /etc/localtime:/etc/localtime:ro -t analogic/poste.io
curl --insecure --request POST --url https://localhost/admin/install/server --form install[hostname]=127.0.0.1 --form install[superAdmin][email protected] --form install[superAdminPassword]=admin

Once the container is up and running you can create a new email address. The credentials used in testing this library are: Host: localhost.dev Port: 993 User: [email protected] Pass: secret

You can run the tests using:

mix deps.get
mix test

Usage

First configure the connection to your IMAP server:

config :eximap,
  account: "[email protected]",
  password: "secret",
  use_ssl: true,
  incoming_mail_server: "localhost.dev",
  incoming_port: 993, #TLS

Then start the connection to the server by calling the start_link method and execute commands.

iex> {:ok, pid} = Eximap.Imap.Client.start_link()
iex> req = Eximap.Imap.Request.noop()
iex> Eximap.Imap.Client.execute(pid, req) |> Map.from_struct()
%{body: [%{}], error: nil,
         message: "NOOP completed (0.000 + 0.000 secs).", partial: false,
         request: %Eximap.Imap.Request{command: "NOOP", params: [],
          tag: "EX1"}, status: "OK"}

Installation

Eximap in available in Hex and can be installed by adding eximap to your list of dependencies in mix.exs:

def deps do
  [
    {:eximap, "~> 0.1.1-dev"}
  ]
end

The documentation is available here: https://hexdocs.pm/eximap/readme.html

eximap's People

Contributors

cosmin-harangus avatar elbrujohalcon avatar gregjohnsonsaltaire avatar khodzha avatar xpdf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.