use of lucee.runtime.spooler.mail.MailSpoolerTask in project Lucee by lucee.
the class SMTPClient method send.
public void send(PageContext pc, long sendTime) throws MailException {
if (plainText == null && htmlText == null)
throw new MailException("you must define plaintext or htmltext");
Server[] servers = ((PageContextImpl) pc).getMailServers();
ConfigWeb config = pc.getConfig();
if (ArrayUtil.isEmpty(servers) && ArrayUtil.isEmpty(host))
throw new MailException("no SMTP Server defined");
if (spool == SPOOL_YES || (spool == SPOOL_UNDEFINED && config.isMailSpoolEnable())) {
MailSpoolerTask mst = new MailSpoolerTask(this, servers, sendTime);
if (listener instanceof Component)
mst.setListener(new ComponentSpoolerTaskListener(SystemUtil.getCurrentContext(), mst, (Component) listener));
else if (listener instanceof UDF)
mst.setListener(new UDFSpoolerTaskListener(SystemUtil.getCurrentContext(), mst, (UDF) listener));
config.getSpoolerEngine().add(mst);
} else
_send(config, servers);
}
Aggregations