mbox4j

Simplify the manipulations with emails for Java-based applications.

Лицензия

Лицензия

${project.licence}
Группа

Группа

io.github.dgroup
Идентификатор

Идентификатор

mbox4j
Последняя версия

Последняя версия

0.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

mbox4j
Simplify the manipulations with emails for Java-based applications.
Ссылка на сайт

Ссылка на сайт

http://github.com/dgroup/mbox4j
Система контроля версий

Система контроля версий

http://github.com/dgroup/mbox4j/tree/master

Скачать mbox4j

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.dgroup/mbox4j/ -->
<dependency>
    <groupId>io.github.dgroup</groupId>
    <artifactId>mbox4j</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.dgroup/mbox4j/
implementation 'io.github.dgroup:mbox4j:0.1.1'
// https://jarcasting.com/artifacts/io.github.dgroup/mbox4j/
implementation ("io.github.dgroup:mbox4j:0.1.1")
'io.github.dgroup:mbox4j:jar:0.1.1'
<dependency org="io.github.dgroup" name="mbox4j" rev="0.1.1">
  <artifact name="mbox4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.dgroup', module='mbox4j', version='0.1.1')
)
libraryDependencies += "io.github.dgroup" % "mbox4j" % "0.1.1"
[io.github.dgroup/mbox4j "0.1.1"]

Зависимости

provided (3)

Идентификатор библиотеки Тип Версия
org.cactoos : cactoos jar 0.42
javax.mail : mail jar 1.5.0-b01
org.hamcrest : hamcrest-all jar 1.3

test (3)

Идентификатор библиотеки Тип Версия
org.llorllale : cactoos-matchers jar 0.17
junit : junit jar 4.12
io.github.dgroup : term4j jar 0.4.0

Модули Проекта

Данный проект не имеет модулей.

Maven Javadocs License: MIT Commit activity Hits-of-Code

Build Status 0pdd Dependency Status Known Vulnerabilities

DevOps By Rultor.com EO badge We recommend IntelliJ IDEA

Qulice SQ maintainability Codebeat Codacy Badge Codecov

What it is

mbox4j is an object-oriented primitives to simplify the manipulations with emails for Java-based applications.

Principles

Design principles behind mbox4j.

How to use

Get the latest version here:

<dependency>
    <groupId>io.github.dgroup</groupId>
    <artifactId>mbox4j</artifactId>
    <version>${version}</version>
</dependency>

Java version required: 1.8+.

Interface Purpose Implementations / Related
Inbox Allows to read the emails from the server JavaxMailInbox, InboxEnvelope, UncheckedInbox, FakeInbox, etc
Outbox Allows to send the emails to the target recipients JavaxMailOutbox, OutboxEnvelope, UncheckedOutbox, FakeOutbox, etc
Msg The email message to be read/sent MsgOf, MsgEnvelope, FakeMsg, etc
Query Email search query to the server QueryOf, Mode, ModeOf, All, etc

All examples below are using the following frameworks/libs:

  • Hamcrest - Library of matchers, which can be combined in to create flexible expressions of intent in tests.
  • cactoos - Object-Oriented Java primitives, as an alternative to Google Guava and Apache Commons.
  • cactoos-matchers - Object-Oriented Hamcrest matchers

Inbox

JavaxMailInbox

Fetch the emails from the server using javax.mail framework:

public static void main(final String[] args) {
    final Properties smtp = new Properties();
    smtp.setProperty("mail.smtp.host", host);
    smtp.setProperty("mail.smtp.port", port);
    smtp.setProperty("username", user);
    smtp.setProperty("password", password);
    ...
    final Inbox inbox = new JavaxMailInbox(smtp);
    final Iterable<Msg> msgs = inbox.read(
        new Query("pop3s", "INBOX", new All())
    );
    for(final Msg msg : msgs) {
        System.out.println(msg);
    }
}

See Gmail SMTP connection properties as an example of a configuration for reading procedure.

Outbox

JavaxMailOutbox

Send an email to the target recipients using javax.mail framework:

public static void main(final String[] args) {
    final Properties smtp = new Properties();
    smtp.setProperty("mail.smtp.host", host);
    smtp.setProperty("mail.smtp.port", port);
    smtp.setProperty("username", user);
    smtp.setProperty("password", password);
    ...
    final Outbox outbox = new JavaxMailOutbox(smtp);
    outbox.send(
        new MsgOf(
            "from@server.com", 
            "to@server.com", 
            "Testing subj", 
            "I'm simple and i know it."
        )
    );
}

See Gmail SMTP connection properties as an example of a configuration for sending procedure.

Версии библиотеки

Версия
0.1.1
0.1.0