On Feb 16, 2009, at 12:57 PM, Matteo Pelucco wrote:


Hi Magnolians,
I'm encountering problems while sending emails.

This code throw exception:
ERROR ch.rtsi.prisma.magnolia.modules.common.managers.AbstractManagerUtils IoManagerUtils.java(sendNotificationByMail:24) 16.02.2009 01:11:53 Can not send email: gnu.mail.handler.TextPlain


? Any idea?

Yes, you could start by checking the type and the stacktrace of the exception ....





******************************************************************


public static void sendNotificationByMail(String recipient, StringBuffer body){
MgnlEmail email;

try {
        
           String mailType = MailConstants.MAIL_TEMPLATE_TEXT;
email = MgnlMailFactory.getInstance().getEmailFromType(mailType);
           email.setBody(body.toString(), null);
           email.setToList(recipient);
           email.setFrom("[email protected]");
           email.setSubject("TEST");
MgnlMailFactory .getInstance().getEmailHandler().prepareAndSendMail(email);
       }
       catch (Exception e) {
// you may want to warn the user redirecting him to a different page...
           log.error("Can not send email: " + e.getMessage());
       }
        }


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to