Search in sources :

Example 1 with MailSpoolerTask

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);
}
Also used : Server(lucee.runtime.net.mail.Server) UDFSpoolerTaskListener(lucee.runtime.spooler.UDFSpoolerTaskListener) UDF(lucee.runtime.type.UDF) MailException(lucee.runtime.net.mail.MailException) PageContextImpl(lucee.runtime.PageContextImpl) MailSpoolerTask(lucee.runtime.spooler.mail.MailSpoolerTask) Component(lucee.runtime.Component) ConfigWeb(lucee.runtime.config.ConfigWeb) ComponentSpoolerTaskListener(lucee.runtime.spooler.ComponentSpoolerTaskListener)

Aggregations

Component (lucee.runtime.Component)1 PageContextImpl (lucee.runtime.PageContextImpl)1 ConfigWeb (lucee.runtime.config.ConfigWeb)1 MailException (lucee.runtime.net.mail.MailException)1 Server (lucee.runtime.net.mail.Server)1 ComponentSpoolerTaskListener (lucee.runtime.spooler.ComponentSpoolerTaskListener)1 UDFSpoolerTaskListener (lucee.runtime.spooler.UDFSpoolerTaskListener)1 MailSpoolerTask (lucee.runtime.spooler.mail.MailSpoolerTask)1 UDF (lucee.runtime.type.UDF)1