Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Project Info

Introduction

Amdatu Email provides a service abstraction for sending email. Currently, it provides implementations to send emails through Amazon's Simple Email Service, through a configured SMTP server, as well as a mock implementation for use in test scenario's.

Usage

Deploy the preferred email service bundle; `org.amdatu.email.smtp` or `org.amdatu.email.aws` with your application and inject the EmailService into components as desired. The EmailService then allows you to send emails through the configured email server.

Dependencies

The Amdatu Email bundle depends on the following bundles:

  1. Apache Felix DependencyManager v3.1.0;
  2. An OSGi ConfigurationAdmin service implementation, for example Apache Felix ConfigAdmin v1.8.0;
  3. (Optionally) an OSGi LogService implementation, for example Apache Felix LogService v1.0.1.

Configuration and example use

AWS Email Server

AWSEmailService is configured by providing a configuration for the PID `org.amdatu.email.aws`. Configuration is done by setting the required `aws-key`, `aws-secret` and optional `aws-region` properties.
When no region is specified, the default region will be chosen.

The following example shows how to send an email through the configured AWSEmailService:

AWSEmailServer example
instance.send(Message.Builder.create().recipient("success@simulator.amazonses.com").htmlBody("test")
.subject("test").from("test@amdatu.com").build());


SMTP Email Server

SMTPEmailService is configured by providing a configuration for the PID `org.amdatu.email.smtp`. Configuration is done by setting the required `smtp-host`, `smtp-user`, `smtp-password` and optional `smtp-port`, `smtp-use-ssl`, `smtp-from-name` and `smtp-from-email` properties.
When no port, use-ssl, from-name and from-email properties have been specified, email will be sent through port 25, not using SSL, from user `Amdatu Mail Service` and address `noreply@amdatu.org` by default.

The following example shows how to send an email through the configured SMTPEmailService:

SMTPEmailService example
String testBody = "Amdatu Mail Service Test";
String testSubject = "Test Message";
instance.send(Message.Builder.create().recipient("someone@example.com").textBody(testBody).subject(testSubject)
.from("test@amdatu.org").build());

License

The Amdatu MongoDB project is licensed under Apache License 2.0.

  • No labels