Search in sources :

Example 21 with SimpleMailMessage

use of org.springframework.mail.SimpleMailMessage in project bitcampSCOpen2017 by ryuyj.

the class SimpleRegistrationNotifier method sendMail.

public void sendMail(Member member) {
    // 보내는 정보를 SimpleMailMessage 객체에 담는다.
    SimpleMailMessage message = new SimpleMailMessage();
    message.setSubject("[회원가입안내]" + member.getMember_name() + "님 회원가입을 축하합니다.");
    message.setFrom("bpppys@Gmail.com");
    message.setText("회원가입이 성공");
    message.setTo(member.getMember_id());
    /*// 메일 보내기 설정
		SimpleMailMessage message = new SimpleMailMessage();
		// 제목설정
		message.setSubject(member.getMember_name() + "님 회원가입을 감사드립니다.");
		// 내용 설정
		message.setText(member.getMember_name() + "님 회원가입을 감사드립니다.");
		// 가입회원의 메일주소 설정
		message.setTo(member.getMember_id());
		// 보내는 메일 설정 
		message.setFrom("bpppys@Gmail.com");*/
    mailSender.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage)

Example 22 with SimpleMailMessage

use of org.springframework.mail.SimpleMailMessage in project bitcampSCOpen2017 by ryuyj.

the class SimpleRegistrationNotifier method sendMail.

public void sendMail(String email, String msg) {
    // 보내는 정보를 SimpleMailMessage 객체에 담는다.
    SimpleMailMessage message = new SimpleMailMessage();
    message.setSubject("[회원가입안내] 회원가입을 축하합니다.");
    message.setFrom("bit@gmail.com");
    message.setText(msg);
    message.setTo(email);
    mailSender.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage)

Example 23 with SimpleMailMessage

use of org.springframework.mail.SimpleMailMessage in project spring-rest-security-boilerplate by springboilerplate.

the class Mailer method constructResendVerificationTokenEmail.

private final SimpleMailMessage constructResendVerificationTokenEmail(final AppUser user, final VerificationToken newToken) {
    SimpleMailMessage email = new SimpleMailMessage();
    email.setTo(user.getEmail());
    email.setSubject("Resend Registration Token");
    email.setText("New token is " + newToken.getToken());
    email.setFrom(env.getProperty("support.email"));
    return email;
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage)

Example 24 with SimpleMailMessage

use of org.springframework.mail.SimpleMailMessage in project spring-rest-security-boilerplate by springboilerplate.

the class Mailer method constructRegistrationEmailMessage.

private final SimpleMailMessage constructRegistrationEmailMessage(final OnRegistrationCompleteEvent event, final AppUser user, final String token) {
    final String recipientAddress = user.getEmail();
    final String subject = "Registration Confirmation";
    // final String confirmationUrl = event.getAppUrl() +
    // "/registrationConfirm.html?token=" + token;
    // final String message = messages.getMessage("message.regSucc", null,
    // event.getLocale());
    final SimpleMailMessage email = new SimpleMailMessage();
    email.setTo(recipientAddress);
    email.setSubject(subject);
    // just sending token
    email.setText("Token is " + token);
    email.setFrom(env.getProperty("support.email"));
    return email;
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage)

Example 25 with SimpleMailMessage

use of org.springframework.mail.SimpleMailMessage in project spring-boot by Linda-Tan.

the class HelloWorldApplicationTests method sendSimpleEmail.

@Test
public void sendSimpleEmail() {
    SimpleMailMessage message = new SimpleMailMessage();
    // 发送者.
    message.setFrom("li926893@163.com");
    // 接收者.
    message.setTo("318615621@qq.com");
    // 邮件主题.
    message.setSubject("测试邮件(邮件主题)");
    // 邮件内容.
    message.setText("这是邮件内容");
    // 发送邮件
    mailSender.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

SimpleMailMessage (org.springframework.mail.SimpleMailMessage)103 MailException (org.springframework.mail.MailException)16 Test (org.junit.Test)12 Test (org.testng.annotations.Test)7 Test (org.junit.jupiter.api.Test)6 User (org.molgenis.data.security.auth.User)5 IOException (java.io.IOException)4 MessagingException (javax.mail.MessagingException)4 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 InternetAddress (jakarta.mail.internet.InternetAddress)3 MimeMessage (jakarta.mail.internet.MimeMessage)3 Date (java.util.Date)3 MimeMessage (javax.mail.internet.MimeMessage)3 RunAsSystem (org.molgenis.security.core.runas.RunAsSystem)3 MolgenisUserException (org.molgenis.security.user.MolgenisUserException)3 JavaMailSenderImpl (org.springframework.mail.javamail.JavaMailSenderImpl)3 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)2 User (fr.codechill.spring.model.User)2 User (gemma.gsec.model.User)2