MockMail

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Группа

Группа

br.com.otavio
Идентификатор

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

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

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

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

MockMail
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Ссылка на сайт

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

https://github.com/garcia-jj/mockmail
Система контроля версий

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

https://github.com/garcia-jj/mockmail

Скачать mockmail

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

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
javax.mail : javax.mail-api jar 1.5.4
com.sun.mail : javax.mail jar 1.5.3

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.8.2

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

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

Mockmail

Mockmail is a simple JavaMail provider to allow you to prevent sending e-mail messages using a real transport, useful when we are testing an application. There are providers to print the message into system console or in a file.

How to install

If you are using Maven as dependency manager you only need to add this line in your pom.xml:

<dependency>
	<groupId>br.com.otavio</groupId>
	<artifactId>mockmail</artifactId>
	<version>0.0.1</version>
</dependency>

Or you can also download the artifact here.

How to use

SysoutTransport

Allow you to print the e-mail message using system console.

public static void main(String[] args) throws Exception {
	final Properties props = new Properties();
	props.put("mail.transport.protocol", "sysout");

	final Session session = Session.getInstance(props);
	final Message msg = new MimeMessage(session);
	msg.setRecipient(Message.RecipientType.TO, new InternetAddress(randomEmail()));
	msg.setFrom(new InternetAddress(randomEmail()));
	msg.setSubject("teste");
	msg.setContent("teste", "text/plain");
	msg.saveChanges();

	session.getTransport().sendMessage(msg, msg.getAllRecipients());
}

FileTransport

Allow you to print the e-mail message into a file.

public static void main(String[] args) throws Exception {
	final Properties props = new Properties();
	props.put("mail.transport.protocol", "file");
	props.put("mail.transport.file.path", "/tmp/maillog.txt");
	props.put("mail.transport.file.append", "false");

	final Session session = Session.getInstance(props);

	final Message msg = new MimeMessage(session);
	msg.setRecipient(Message.RecipientType.TO, new InternetAddress(randomEmail()));
	msg.setFrom(new InternetAddress(randomEmail()));
	msg.setSubject("teste");
	msg.setContent("teste", "text/plain");
	msg.saveChanges();

	session.getTransport().sendMessage(msg, msg.getAllRecipients());
}

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

Версия
0.0.1