Example usage for org.springframework.mail SimpleMailMessage setText

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

Introduction

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

Prototype

@Override
    public void setText(String text) 

Source Link

Usage

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

/**
 * This method will send email to customer/faculty/admin etc
 *
 * @param mailSender Java email sender/*from ww w  . ja  v a2s .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/* w  w w  . jav a 2s  . 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   ww  w .ja  v a2 s  .  c  o  m*/
        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:ru.retbansk.utils.UsefulMethods.java

/**
 * For testing usage//from   w  w  w .j  ava 2s. co  m
 * Sending to mr.server.serverovich@yandex.ru four reports.
 * <p> One is invalid. Two from one email address
 * @throws InterruptedException I used Thread.sleep method in be ensure in the order of sending
 */
public static void populate() throws InterruptedException {
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    SimpleMailMessage msg = new SimpleMailMessage();
    msg.setFrom("another.tester@yandex.ru");
    msg.setSubject("Test report 4");
    msg.setTo("mr.server.serverovich@yandex.ru");
    msg.setText("   ,  ??, 8");
    mailSender.setHost("smtp.yandex.ru");
    mailSender.setUsername("another.tester@yandex.ru");
    mailSender.setPassword("tester");
    mailSender.send(msg);
    SimpleMailMessage[] msgs = new SimpleMailMessage[3];
    for (int i = 0; i < 3; i++) {
        msgs[i] = new SimpleMailMessage();
        msgs[i].setFrom("tester.testerovich@yandex.ru");
        msgs[i].setSubject("Test report " + (i + 1));
        msgs[i].setTo("mr.server.serverovich@yandex.ru");
    }
    msgs[2].setText(
            "helping Google with Android, in process, 7\nmain job/ in process/1\nnothing actually. done. 3");
    msgs[1].setText("Testing error report");
    msgs[0].setText(", , 2\n,  ??, 6");
    mailSender.setUsername("tester.testerovich@yandex.ru");
    mailSender.setPassword("tester");
    Thread.sleep(1000);
    mailSender.send(msgs[0]);
    Thread.sleep(1000);
    mailSender.send(msgs[1]);
    Thread.sleep(1000);
    mailSender.send(msgs[2]);

}

From source file:com.rxx.common.util.MailUtil.java

/**
 * //from w  w w  . ja va 2 s  .  c  om
 *
 * @param host 
 * @param port
 * @param userName
 * @param password
 * @param title
 * @param content
 * @param toUser
 */
public static void sendText(String host, int port, String userName, String password, String title,
        String content, String[] toUser) {
    JavaMailSenderImpl senderImpl = new JavaMailSenderImpl();
    // mail server
    senderImpl.setHost(host);
    senderImpl.setPort(port);
    // 
    SimpleMailMessage mailMessage = new SimpleMailMessage();
    //  
    // String[] array = new String[] {"sun111@163.com","sun222@sohu.com"};
    // mailMessage.setTo(array);
    mailMessage.setTo(toUser);
    mailMessage.setFrom(userName);
    mailMessage.setSubject(title);
    mailMessage.setText(content);

    senderImpl.setUsername(userName); // ,username
    senderImpl.setPassword(password); // , password

    Properties prop = new Properties();
    prop.put(" mail.smtp.auth ", " true "); // true,
    prop.put(" mail.smtp.timeout ", " 25000 ");
    senderImpl.setJavaMailProperties(prop);
    // 
    senderImpl.send(mailMessage);
}

From source file:com.impetus.kundera.ycsb.utils.MailUtils.java

private static void onSendEmail(Map<String, Double> delta, String operationType, String dataStore,
        String[] reciepents) {/* ww w . ja v a2s  .  c om*/
    String host = "192.168.150.5";
    JavaMailSenderImpl emailSender = new JavaMailSenderImpl();
    emailSender.setHost(host);
    // emailSender.setPort(port);
    emailSender.setUsername("noreply-kundea@impetus.co.in");
    SimpleMailMessage mail = new SimpleMailMessage();
    mail.setTo(reciepents);
    mail.setFrom("noreply-kundea@impetus.co.in");

    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.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  a2  s  .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.badgersoft.eseoprocessor.service.MailServiceImpl.java

public void sendAlertMail(String alert) {

    SimpleMailMessage mailMessage = new SimpleMailMessage(alertMailMessage);
    mailMessage.setText(alert);
    mailSender.send(mailMessage);//from www .  j a  v a2s. c o m

}

From source file:support.SendMail.java

public void sendMail(String email, String text) {
    SimpleMailMessage message = new SimpleMailMessage();
    message.setTo(email);/*from  ww w.  jav a2  s.co  m*/
    message.setText(text);
    mailSender.send(message);
}

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);/*from w w w  .ja  v  a 2s.com*/
    message.setSubject(subject);
    message.setText(body);
    mailSender.send(message);
}