Hi Jan,
no mailFactory is ok but the call final MgnlEmail email =
mailFactory.getEmailFromType(new HashMap(), mailType);
results in email is null!
MailModule is installed …
Is my code right? Whats wrong? My code again:
private void sendErrorMail(String message, String subject, String
recipientList) {
try {
final MgnlMailFactory mailFactory = ((MailModule)
ModuleRegistry.Factory.getInstance().getModuleInstance("mail")).getFactory();
String mailType = MailConstants.MAIL_TEMPLATE_SIMPLE;
final MgnlEmail email = mailFactory.getEmailFromType(new HashMap(),
mailType);
email.setBody(message);
email.setToList(recipientList);
email.setFrom("[email protected]");
email.setSubject(subject);
mailFactory.getEmailHandler().prepareAndSendMail(email);
} catch (Exception e) {
log.error("Can not send email: " + e.getMessage() + ";");
System.out.println("*** STACKTRACE ***");
e.printStackTrace();
}
}
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=e4e9a298-5e07-456a-a266-7593697f972c
----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------