Java Sendmail

A simple Java send email library

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

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

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

java-sendmail
Последняя версия

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

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Java Sendmail
A simple Java send email library
Ссылка на сайт

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

https://github.com/johnpili/java-sendmail.git

Скачать java-sendmail

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

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

Зависимости

compile (2)

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

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

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

java-sendmail

A simple java send email library

Usage example

Sendmail sendmail = new Sendmail.Config()
    .properties(properties)
    .from(from)
	.to(targetRecipient)
	.subject(subject)
	.textMessagePart(plainTextMessage)
	.htmlMessagePart(htmlMessage)
	.smtpUsername(appConfig.getSmtpUsername())
	.smtpPassword(appConfig.getSmtpPassword())
	.build();

new Thread(sendmail).start();
## Code example in a service method

public void sendEmailNotification(String targetRecipient, String subject, String plainTextMessage, String htmlMessage)
	{
		try
		{
			String from = "johnpili.com <no-reply@johnpili.com>";
			String host = appConfig.getSmtpHost();
			String port = appConfig.getSmtpPort();

			Properties properties = System.getProperties();
			properties.put("mail.transport.protocol", "smtp");
			properties.put("mail.smtp.socketFactory.port", port);
			properties.put("mail.smtp.socketFactory.class",
					"javax.net.ssl.SSLSocketFactory");
			properties.put("mail.smtp.host", host);
			if (appConfig.isSmtpRequireAuthentication())
			{
				properties.put("mail.smtp.auth", "true");
			}
			properties.put("mail.smtp.port", port);

			Sendmail sendmail = new Sendmail.Config()
					.properties(properties)
					.from(from)
					.to(targetRecipient)
					.subject(subject)
					.textMessagePart(plainTextMessage)
					.htmlMessagePart(htmlMessage)
					.smtpUsername(appConfig.getSmtpUsername())
					.smtpPassword(appConfig.getSmtpPassword())
					.build();

			new Thread(sendmail).start();
		}
		catch (Exception exception)
		{
			logger.error("sendEmailNotification Error: " + exception.getMessage());
		}
	}
  
  

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

Версия
1.0.1