I try to send a simple plain text mail with the magnolia api- but i always get 
null pointer exception: Plz Help!


   private void sendErrorMail(String message, String subject, String 
recipientList) {
        try {
            final MgnlMailFactory mailFactory = ((MailModule) 
ModuleRegistry.Factory.getInstance().getModuleInstance("mail")).getFactory();
            MailModule mailModule = new MailModule();
            String mailType = MailConstants.MAIL_TEMPLATE_SIMPLE;
            
            //new HashMap wrong??
            final MgnlEmail email = mailFactory.getEmailFromType(new HashMap(), 
mailType);
            //email.setBody(message);
            email.setToList(recipientList);
            email.setFrom("webmas...@test.com");
            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: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to