Example usage for org.springframework.mail SimpleMailMessage setSubject

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

Introduction

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

Prototype

@Override
    public void setSubject(String subject) 

Source Link

Usage

From source file:com.precioustech.fxtrading.tradingbot.events.notification.email.EventEmailNotifier.java

@Subscribe
@AllowConcurrentEvents//from  ww  w.  ja  v a 2s.co m
public void notifyByEmail(EventPayLoad<T> payLoad) {
    Preconditions.checkNotNull(payLoad);
    EmailContentGenerator<T> emailContentGenerator = eventEmailContentGeneratorMap.get(payLoad.getEvent());
    if (emailContentGenerator != null) {
        EmailPayLoad emailPayLoad = emailContentGenerator.generate(payLoad);
        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setSubject(emailPayLoad.getSubject());
        msg.setTo(tradingConfig.getMailTo());
        msg.setText(emailPayLoad.getBody());
        this.mailSender.send(msg);
    } else {
        LOG.warn("No email content generator found for event:" + payLoad.getEvent().name());
    }
}

From source file:csns.util.MassMailSender.java

public void send(AbstractMessage message, Subscribable subscribable) {
    SimpleMailMessage email = new SimpleMailMessage();
    email.setSubject(message.getSubject());
    email.setText(emailUtils.getText(message));
    email.setFrom(message.getAuthor().getPrimaryEmail());
    email.setTo(emailUtils.getAppEmail());
    send(email, emailUtils.getAddresses(subscribable));
}

From source file:uk.ac.ebi.intact.editor.batch.admin.MailNotifierStepExecutionListener.java

public void beforeStep(StepExecution stepExecution) {

    SimpleMailMessage message = newSimpleMessage();
    message.setSubject("[Editor_import] Started step: " + stepExecution.getStepName() + "");
    message.setText(stepExecution.getSummary() + "\n" + stepExecution.getJobExecution());
    message.setTo(stepExecution.getJobParameters().getString("email.recipient"));

    try {//from w  w w  . j  a v  a 2  s . c  o  m
        mailSender.send(message);
    } catch (MailException e) {
        log.error("Impossible to send e-mail", e);
    }
}

From source file:uk.ac.ebi.intact.editor.batch.admin.MailNotifierStepExecutionListener.java

public ExitStatus afterStep(StepExecution stepExecution) {

    SimpleMailMessage message = newSimpleMessage();
    message.setSubject("[Editor_import] Finished step: " + stepExecution.getStepName() + " Exit status: "
            + stepExecution.getExitStatus().getExitCode());
    message.setText(stepExecution.toString() + "\n" + stepExecution.getExecutionContext());
    message.setText(stepExecution.toString() + "\n" + stepExecution.getSummary() + "\n"
            + stepExecution.getJobExecution());
    message.setTo(stepExecution.getJobParameters().getString("email.recipient"));

    try {/*from  w w  w. ja v a2  s.c  o m*/
        mailSender.send(message);
    } catch (MailException e) {
        log.error("Impossible to send e-mail", e);
    }

    return stepExecution.getExitStatus();
}

From source file:org.cloudbyexample.dc.service.si.notification.NotificationProcessor.java

public void process(Application application, @Header(PROVISION_HEADER) ProvisionTask task) {
    for (Notification notification : task.getNotifications()) {
        SimpleMailMessage msg = new SimpleMailMessage(simpleMailMessageg);
        msg.setSubject("Docker Control Provision Notification");
        msg.setTo(notification.getEmail());

        Map<String, Object> vars = new HashMap<String, Object>();
        vars.put("application", application);
        vars.put("task", task);

        sender.send(msg, PROVISION_TEMPLATE, vars);

        logger.debug("Sent provision message to '{}' for '{}'.  id={}", notification.getEmail(),
                application.getName(), task.getId());
    }//from   w w  w  .  j  a  v a  2 s .  c o  m
}

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);//ww  w  .j  a  va2  s.c o  m
    message.setSubject(subject);
    message.setText(msg);
    mailSender.send(message);
}

From source file:example.web.EmailController.java

private String sendMail(String subject) {
    String results = "Failed to send message: ";
    try {//from   w w  w  .ja  v a 2 s .  c  o m
        SimpleMailMessage msg = new SimpleMailMessage(this.templateMessage);
        msg.setSubject(subject);
        this.mailSender.send(msg);
        results = "Sent message with subject '" + subject + "'!";
    } catch (MailException ex) {
        results += ex.getMessage();
        System.err.println(results);
        ex.printStackTrace();
    }
    return results;
}

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);//  w  ww .  ja v  a2  s .  c o m
    message.setTo(to);
    message.setSubject(subject);
    message.setText(msg);
    mailSender.send(message);
}

From source file:org.callistasoftware.netcare.core.spi.impl.EmailNotificationServiceImpl.java

private void doSendEmail(final String message, final String subject, final String toAddress) {
    log.info("Delivering email message '{}' to {}", subject, toAddress);

    final SimpleMailMessage smm = new SimpleMailMessage();
    smm.setTo(toAddress);//from  w w  w. j  a va  2 s . c om
    smm.setSubject(subject);
    smm.setText(message);

    try {
        this.mailSender.send(smm);
    } catch (final MailException e) {
        log.warn("Could not deliver email message. Reason: {}", e.getMessage());
    }
}

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

/**
 * Sends simple mail message/* w w w  .j a  v a 2 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);
}