SeamFramework.orgCommunity Documentation

Chapter 48. Seam Mail Introduction

48.1. Getting Started

Seam mail is an portable CDI extension designed to make working with Java Mail easier via standard methods or plugable templating engines.

No better way to start off then with a simple example to show what we are talking about.



@Inject
private Instance<MailMessage> mailMessage;
         
public void sendMail() {
    MailMessage m = mailMessage.get();
    m.from("John Doe<john@test.com>")
       .to("Jane Doe<jane@test.com>")
       .subject(subject)
       .bodyHtml(htmlBody)
       .importance(MessagePriority.HIGH)
       .send();
}

Very little is required to enable this level of functionality in your application. Let's start off with a little required configuration.