1. pom.xml:
--------------------------------------------------------------------------------------
javax.servlet
servlet-api
2.4
provided
javax.servlet
servlet-api
2.4
provided
2. if using template to generate files, create one for text, one for html.
By default, the files names are exepected to end with "-text.ftl", "-html.ftl"
as the extensions
--------------------------------------------------------------------------------------
A.) xxx-html.ftl:
good
Thank you ${name} for your job submission. You result is now available at goolge
B.) xxx-test.ftl:
Thank you ${name} for your job submission. You result is now available at goolge
3. in src/main/resources (add spring-mail.xml or whatever name desired, and change as needed)
--------------------------------------------------------------------------------------
]]>
0
UTF-8
zh_CN
4. to use:
--------------------------------------------------------------------------------------
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("spring-mail.xml");
MailService mailservice = (MailService) appContext.getBean("mailService");
Map model = new HashMap();
model.put("name", "lcchan"); // if you need to replace content in the template *.ftl)
mailservice.sendMimeMessage("lcchan.temp@gmail.com", "job", model);
mailservice.sendSimpleMessage("lucie.chan@gmail.com", "just a test message");