use of org.springframework.mail.SimpleMailMessage in project bitcampSCOpen2017 by ryuyj.
the class SimpleRegistrationNotifier method sendMail.
public void sendMail(String memberemail) {
SimpleMailMessage message = new SimpleMailMessage();
message.setSubject("[Simple] 회원 가입 안내");
message.setFrom("isisncorp@gmail.com");
message.setText("회원 가입을 환영합니다.");
message.setTo(memberemail);
try {
mailSender.send(message);
} catch (MailException ex) {
ex.printStackTrace();
}
}
use of org.springframework.mail.SimpleMailMessage in project java-examples by urvanov-ru.
the class App method main.
public static void main(String[] args) {
try (GenericXmlApplicationContext context = new GenericXmlApplicationContext()) {
context.load("classpath:applicationContext.xml");
context.refresh();
JavaMailSender mailSender = context.getBean("mailSender", JavaMailSender.class);
SimpleMailMessage templateMessage = context.getBean("templateMessage", SimpleMailMessage.class);
// Создаём потокобезопасную копию шаблона.
SimpleMailMessage mailMessage = new SimpleMailMessage(templateMessage);
// TODO: Сюда напишите свой e-mail получателя.
mailMessage.setTo("ouhb93u4hng9hndf9@mail.ru");
mailMessage.setText("Привет, товарищи. Присылаю вам письмо...");
try {
mailSender.send(mailMessage);
System.out.println("Mail sended");
} catch (MailException mailException) {
System.out.println("Mail send failed.");
mailException.printStackTrace();
}
}
}
use of org.springframework.mail.SimpleMailMessage in project trainning by fernandotomasio.
the class SystemServiceSimpleImpl method sendMail.
@Override
@Transactional
public void sendMail(String to, String subject, String text) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom("sgc@decea.intraer");
message.setTo(to);
message.setSubject(subject);
message.setText(text);
if (to != null) {
try {
mailSender.send(message);
} catch (MailException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
}
}
}
use of org.springframework.mail.SimpleMailMessage in project Gemma by PavlidisLab.
the class MailEngineImpl method sendAdminMessage.
/**
* Sends a message to the gemma administrator as defined in the Gemma.properties file
*/
@Override
public void sendAdminMessage(String bodyText, String subject) {
if ((bodyText == null) && (subject == null)) {
MailEngineImpl.log.warn("Not sending empty email, both subject and body are null");
return;
}
MailEngineImpl.log.info("Sending email notification to administrator regarding: " + subject);
SimpleMailMessage msg = new SimpleMailMessage();
msg.setTo(Settings.getAdminEmailAddress());
msg.setFrom(Settings.getAdminEmailAddress());
msg.setSubject(subject);
msg.setText(bodyText);
this.send(msg);
}
use of org.springframework.mail.SimpleMailMessage in project Gemma by PavlidisLab.
the class TableMaintenanceUtilImpl method sendEmail.
private void sendEmail(Gene2CsStatus results) {
if (!sendEmail)
return;
SimpleMailMessage msg = new SimpleMailMessage();
String adminEmailAddress = Settings.getAdminEmailAddress();
if (StringUtils.isBlank(adminEmailAddress)) {
TableMaintenanceUtilImpl.log.warn("No administrator email address could be found, so gene2cs status email will not be sent.");
return;
}
msg.setTo(adminEmailAddress);
msg.setSubject("Gene2Cs update status.");
msg.setText("Gene2Cs updating was run.\n" + results.getAnnotation());
mailEngine.send(msg);
TableMaintenanceUtilImpl.log.info("Email notification sent to " + adminEmailAddress);
}
Aggregations