My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members
Links

******************************************************************************** ******************************************************************************** ********************************************************************************

This project moved to Github!

Please go to http://github.com/guilhermechapiewski/fluent-mail-api to get the latest version and documentation.

******************************************************************************** ******************************************************************************** ********************************************************************************

About

Fluent Mail API is a simple Java API that uses Sun's JavaMail API to send e-mail messages. This is a project to demonstrate Fluent Interfaces usage.

Usage example

new EmailMessage()
    .from("demo@guilhermechapiewski.com")
    .to("destination@address.com")
    .withSubject("Fluent Mail API")
    .withBody("Demo message")
    .send();

Comparison to JavaMail API

If you use pure JavaMail API, it will be something like this (from Java World tutorial):

// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", _smtpHost);
Session session = Session.getDefaultInstance(props, null);
        
// create a message
Address replyToList[] = { new InternetAddress(replyTo) };
Message newMessage = new MimeMessage(session);
if (_fromName != null)
    newMessage.setFrom(new InternetAddress(from,
        _fromName + " on behalf of " + replyTo));
else
    newMessage.setFrom(new InternetAddress(from));
    newMessage.setReplyTo(replyToList);
    newMessage.setRecipients(Message.RecipientType.BCC, _toList);
    newMessage.setSubject(subject);
    newMessage.setSentDate(sentDate);

// send newMessage
Transport transport = session.getTransport(SMTP_MAIL);
transport.connect(_smtpHost, _user, _password);
transport.sendMessage(newMessage, _toList);

20 second tutorial

Please go to http://github.com/guilhermechapiewski/fluent-mail-api to get the latest version and documentation.

Powered by Google Project Hosting