Created
January 13, 2009 08:36
-
-
Save shimarin/46368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iso-2022-jp(JIS)でメールを送るサンプル | |
// from=送信元 to=送信先 subject=題名 body=本文 | |
// mailSenderは org.springframework.mail.javamail.JavaMailSenderImplのインスタンス | |
final String ENCODING = "iso-2022-jp"; | |
MimeMessage mm = mailSender.createMimeMessage(); | |
MimeMailMessage mmm = new MimeMailMessage(mm); | |
mmm.setFrom(from); | |
mmm.setTo(to); | |
mm.setSubject(subject, ENCODING); | |
mm.setText(body, ENCODING); | |
mm.setHeader("Content-Transfer-Encoding", "7bit"); | |
mailSender.send(mm); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment