I have seen the solution regarding this question but i did not found any solution for my scenario. my mailsender.xml is
<bean id="velocityEngine"
class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="resourceLoaderPath" value="/email_Templates" />
<property name="preferFileSystemAccess" value="false" />
</bean>
and my velocity implementation code is..
public void sendUserActivationMail(User user, String requestUrl) throws Exception {
String plainText = System.currentTimeMillis() + "##" + user.getUserId();
userDao.insertRegistraionToken(user.getUserId(), plainText, "123456");
String token = AESEncrypter.encrypt(plainText);
String url = requestUrl + "/activateUser.htm?token=" + URLEncoder.encode(token, "UTF-8");
try {
Map<String, Object> storemap = new HashMap<String, Object>();
storemap.put("toUserName", user.getName());
storemap.put("fromUseerName", ApplicationConstants.TEAM_NAME);
storemap.put("url", url);
String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "verificationEmail.vm", "UTF-8", storemap);
mailService.sendMail(senderMailId, new String[] { user.getEmail() }, null, "Registration Activation", text);
} catch (Exception e) {
logger.println(IMessage.ERROR,new StringBuilder(CLASS_NAME).append("::runProfileIncompleteCron() exception ==" + e));
}
}
my folder structure is-
src/main/resources
|_email_Templates
|
|__verificationEmail.vm
But is shows error
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'verificationEmail.vm'