Example usage for org.springframework.mail SimpleMailMessage SimpleMailMessage

List of usage examples for org.springframework.mail SimpleMailMessage SimpleMailMessage

Introduction

In this page you can find the example usage for org.springframework.mail SimpleMailMessage SimpleMailMessage.

Prototype

public SimpleMailMessage() 

Source Link

Document

Create a new SimpleMailMessage .

Usage

From source file:cs544.letmegiveexam.util.EmailManager.java

/**
 * This method will send email to customer/faculty/admin etc
 *
 * @param mailSender Java email sender/* ww w .  ja v  a 2 s .c o m*/
 * @param subject Email subject
 * @param body Email body
 * @param mailTo Mail to information
 */
public static void sendEmail(JavaMailSender mailSender, String subject, String body, String mailTo) {

    SimpleMailMessage email = new SimpleMailMessage();

    email.setText(body);
    email.setTo(mailTo);
    email.setSubject(subject);
    mailSender.send(email);
}

From source file:com.saviour.poweryoga.util.EmailManager.java

/**
 * This method will send email to customer/faculty/admin etc
 *
 * @param mailSender Java email sender/*from   w w  w.  j  a v  a2  s.  c o  m*/
 * @param subject Email subject
 * @param body Email body
 * @param mailTo Mail to information
 */
public static void sendEmail(JavaMailSender mailSender, String subject, String body, String mailTo) {

    SimpleMailMessage email = new SimpleMailMessage();
    //String link = "http://localhost:8080/mycompany.com/activation/" + encodedUser;
    email.setText(body);
    email.setTo(mailTo);
    email.setSubject(subject);
    mailSender.send(email);
}

From source file:app.commons.EmailUtils.java

public static void send(String subject, String text) {
    try {/*from w w w  . java 2  s. c om*/
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(FROM_EMAIL_ADRRESS);
        message.setTo(TO_EMAIL_ADRRESS);
        message.setSubject(subject);
        message.setText(text);

        mailSender.send(message);
    } catch (MailSendException e) {
    } catch (MailException e) {
    }
}

From source file:com.iucosoft.eavertizare.util.MyMailSender.java

public void sendMail(String to, String subject, String msg) {

    SimpleMailMessage message = new SimpleMailMessage();

    //message.setFrom(from);
    message.setTo(to);//  w  ww. j a  va  2 s.  c  om
    message.setSubject(subject);
    message.setText(msg);
    mailSender.send(message);
}

From source file:pl.edu.agh.MailUtils.java

/**
 * Sends simple mail message//from   w ww .  j  a va2 s.c  o  m
 */
public void sendMail(String from, String to, String subject, String content) {

    SimpleMailMessage message = new SimpleMailMessage();

    message.setFrom(from);
    message.setTo(to);
    message.setSubject(subject);
    message.setText(content);
    mailSender.send(message);
}

From source file:onlinevideo.aop.MailDispatcher.java

@Override
public void sendMail(String from, String to, String subject, String msg) {
    SimpleMailMessage message = new SimpleMailMessage();

    message.setFrom(from);/*from  w  w w.j  a  va2  s.c  o  m*/
    message.setTo(to);
    message.setSubject(subject);
    message.setText(msg);
    mailSender.send(message);
}

From source file:com.impetus.benchmark.utils.MailUtils.java

public static void sendMail(Map<String, Double> delta, String operationType, String dataStore) {
    String host = "mail1.impetus.co.in";
    int port = 465;
    Properties props = new Properties();
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    // props.put("mail.smtp.port", "465");
    props.put("mail.smtp.host", host);

    JavaMailSenderImpl emailSender = new JavaMailSenderImpl();
    emailSender.setHost(host);/* w  w w  .  j a v a  2s. c o m*/
    // emailSender.setPort(port);
    emailSender.setUsername("amresh.singh@impetus.co.in");
    emailSender.setPassword("dragon@131");
    emailSender.setJavaMailProperties(props);
    SimpleMailMessage mail = new SimpleMailMessage();
    mail.setTo(new String[] { /*"vivek.mishra@impetus.co.in",*/ "amresh.singh@impetus.co.in",
            /*"kuldeep.mishra@impetus.co.in"*//*, "vivek.shrivastava@impetus.co.in"*/ });
    mail.setFrom("amresh.singh@impetus.co.in");
    mail.setReplyTo("amresh.singh@impetus.co.in");

    // mail.se
    if (operationType.equalsIgnoreCase("load")) {
        operationType = "write";
    } else if (operationType.equalsIgnoreCase("t")) {
        operationType = "read";
    }
    mail.setSubject(operationType + " kundera-" + dataStore + "-performance Delta");
    String mailBody = null;
    for (String key : delta.keySet()) {
        if (mailBody == null) {
            mailBody = key + " Performance Delta ==> " + delta.get(key) + " \n";
        } else {
            mailBody = mailBody + key + " Performance Delta ==> " + delta.get(key) + " \n";
        }
    }
    mail.setText(mailBody);
    emailSender.send(mail);
}

From source file:com.lnu.agile.mail.ApplicationMailer.java

@Override
public void sendMail(String to, String subject, String body) {
    SimpleMailMessage message = new SimpleMailMessage();
    message.setTo(to);/*  w  ww . jav a  2  s  . co m*/
    message.setSubject(subject);
    message.setText(body);
    mailSender.send(message);
}

From source file:org.esupportail.pushnotification.service.Mail.java

public void sendMail(String from, String to, String subject, String msg) {
    //creating message
    SimpleMailMessage message = new SimpleMailMessage();
    message.setFrom(from);//from ww w . ja  va2 s  . com
    message.setTo(to);
    message.setSubject(subject);
    message.setText(msg);
    //sending message
    mailSender.send(message);
}

From source file:com.przemo.projectmanagementweb.services.MailService.java

void sendAccountConfirmationEmail(String email, String link) {
    try {//from   w w w . j a va  2s. c  o  m
        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setSubject("Project Management System account activation.");
        msg.setFrom("info@pncomp.com");
        msg.setTo(email);
        msg.setText("Please click the following below to activate your account. " + link);
        try {
            mailSender.send(msg);
        } catch (MailException mex) {
            LoggerFactory.getLogger(getClass()).error("From Mail Service MailException: ");
            LoggerFactory.getLogger(getClass()).error(mex.getMessage());
        }
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("From Mail Service Exception: ");
    }

}