WOComponent mailPage = (WOComponent) ERMailUtils.instantiatePage
WOComponent mailPage = ERMailUtils.instantiatePage
    public static void sendHTMLMail (ERMailDeliveryHTML delivery,                                     String pageName,  String alternatePageName,                                     String emailFrom, String emailTo,                                     String emailReplyTo, String subject) {        WOComponent mailPage = (WOComponent) ERMailUtils.instantiatePage            (pageName, delivery.sessionDictionary ());        delivery.newMail ();        delivery.setComponent (mailPage);        if (alternatePageName != null) {            String alternateString = null;            WOComponent alternateMailTemplate =                (WOComponent) ERMailUtils.instantiatePage                (alternatePageName, delivery.sessionDictionary ());            alternateString =                 alternateMailTemplate.generateResponse ().contentString ();            if (alternateString != null) {                delivery.setHiddenPlainTextContent (alternateString);                alternateMailTemplate.session ().terminate ();            }        }        try {            delivery.setFromAddress    (emailFrom);            delivery.setToAddress      (emailTo);            delivery.setReplyToAddress (emailReplyTo);            delivery.setSubject ((subject == null) ? "" : subject);            delivery.sendMail ();        } catch (javax.mail.MessagingException e) {            // we must handle this exception correctly because the            // mail cannot be sent            log.warn ("While trying to sendMail: ", e);        } finally {            // We need to force the termination of the sessions            // because there is some sort of circular reference            // between the context and the session when it is            // instantiated from a newly created WOContext.            mailPage.session ().terminate ();        }    }