Search in sources :

Example 1 with SenderMailInfo

use of com.kyj.fx.voeditor.visual.framework.mail.SenderMailInfo in project Gargoyle by callakrsos.

the class MailUtil method sendMail.

/**
	 * 메일전송
	 *
	 * @Date 2015. 9. 13.
	 * @param mail
	 *            메일을 보내기 위한 정보가 담긴 객체
	 * @param mailContent
	 *            메일템플릿안에 들어갈 내용이 담기는 정보.
	 * @throws Exception
	 * @User KYJ
	 */
public static boolean sendMail(List<Mail> mails, Map<String, Object> mailContent) throws Exception {
    try {
        Mailer bean = BeanUtil.getBean("mailer", Mailer.class);
        VelocityContext merge = toVelocityContext(mailContent);
        SenderMailInfo sender = BeanUtil.getBean("mailSenderInfo", SenderMailInfo.class);
        bean.sendMail(sender, mails, merge);
    } catch (Exception e) {
        LOGGER.error(ValueUtil.toString(e));
        return false;
    }
    return true;
}
Also used : VelocityContext(org.apache.velocity.VelocityContext) Mailer(com.kyj.fx.voeditor.visual.framework.mail.Mailer) SenderMailInfo(com.kyj.fx.voeditor.visual.framework.mail.SenderMailInfo)

Example 2 with SenderMailInfo

use of com.kyj.fx.voeditor.visual.framework.mail.SenderMailInfo in project Gargoyle by callakrsos.

the class MailUtilTest method sendMailTest.

@Test
public void sendMailTest() throws Exception {
    Mail mail = new Mail();
    mail.setMailTo(new String[] { "", "" });
    Map<String, Object> velocityContext = new HashMap<>();
    velocityContext.put("seq", "667");
    velocityContext.put("date", "2015-09-12");
    velocityContext.put("numbers", "테스트번호입니다.");
    SenderMailInfo senderMailInfo = new SenderMailInfo();
    senderMailInfo.setSendUserId("");
    senderMailInfo.setSendUserPassword("");
    MailUtil.sendMail(senderMailInfo, mail, velocityContext);
}
Also used : Mail(com.kyj.fx.voeditor.visual.framework.mail.Mail) HashMap(java.util.HashMap) SenderMailInfo(com.kyj.fx.voeditor.visual.framework.mail.SenderMailInfo) Test(org.junit.Test)

Aggregations

SenderMailInfo (com.kyj.fx.voeditor.visual.framework.mail.SenderMailInfo)2 Mail (com.kyj.fx.voeditor.visual.framework.mail.Mail)1 Mailer (com.kyj.fx.voeditor.visual.framework.mail.Mailer)1 HashMap (java.util.HashMap)1 VelocityContext (org.apache.velocity.VelocityContext)1 Test (org.junit.Test)1