Example usage for org.apache.commons.mail EmailConstants TEXT_HTML

List of usage examples for org.apache.commons.mail EmailConstants TEXT_HTML

Introduction

In this page you can find the example usage for org.apache.commons.mail EmailConstants TEXT_HTML.

Prototype

String TEXT_HTML

To view the source code for org.apache.commons.mail EmailConstants TEXT_HTML.

Click Source Link

Document

defines the text/html content type

Usage

From source file:io.mif.labanorodraugai.services.EmailService.java

public void SendInvitationEmail(Account sender, String toEmail) throws EmailException, MalformedURLException {
    //ImageHtmlEmail email = new ImageHtmlEmail();
    HtmlEmail email = new HtmlEmail();
    setUpHtmlEmail(email);//w  ww . ja  v a  2s .  c o  m
    email.addTo(toEmail);
    email.setSubject("Labanoro draug kvietimas");

    StringBuilder msg = new StringBuilder();
    //msg.append("<div><img src=\"" + baseUrl + "/images/lab  anorodraugai.JPG\"></div>");
    msg.append("<h4>Sveiki,</h4>");
    msg.append("<p>" + sender.getName() + " " + sender.getLastname()
            + " kvie?ia Jus tapti bendrijos Labanoro draugai nariu!</p>");
    msg.append("<p>T padaryti galite usiregistrav ");
    msg.append("<a href=" + "\"http://localhost:8080/LabanoroDraugai/registration/registration.html\">");
    msg.append("?ia</a></p>");

    email.setContent(msg.toString(), EmailConstants.TEXT_HTML);

    email.send();
}

From source file:io.mif.labanorodraugai.services.EmailService.java

public void sendApprovalRequestEmail(AccountApproval approval) throws EmailException, MalformedURLException {
    HtmlEmail email = new HtmlEmail();
    setUpHtmlEmail(email);/*from  w  ww .  j  a  va  2 s .c  om*/
    email.addTo(approval.getApprover().getEmail());
    email.setSubject("Naujo nario rekomendacija");

    Account candidate = approval.getCandidate();

    StringBuilder msg = new StringBuilder();
    //msg.append("<div><img src=\"" + baseUrl + "/images/lab  anorodraugai.JPG\"></div>");
    msg.append("<h4>Sveiki,</h4>");
    msg.append("<p>" + candidate.getName() + " " + candidate.getLastname() + " (" + candidate.getEmail()
            + ") nori tapti Labanoro Draugai nariu ir prao Js suteikti rekomendacij!</p>");
    msg.append("<p>T padaryti galite: ");
    msg.append("<a href=" + "\"http://localhost:8080/LabanoroDraugai/registration/approval.html?gen="
            + approval.getGeneratedId() + "\">");
    msg.append("?ia</a></p>");

    email.setContent(msg.toString(), EmailConstants.TEXT_HTML);

    email.send();
}

From source file:org.exoplatform.social.notification.mail.FakeMailService.java

@Override
public void sendMessage(Message message) throws Exception {
    SimpleEmail email = new SimpleEmail();
    email.setHostName("localhost");
    email.setSmtpPort(2525);//from   w w  w . j av a  2 s .  c  om
    email.setStartTLSEnabled(true);
    email.setFrom(message.getFrom());
    email.setSubject(message.getSubject());
    email.setContent(message.getBody(), EmailConstants.TEXT_HTML);
    email.addTo(message.getTo());
    email.send();
}