<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
    <!--
     Send e-mail API. Is used for testing purposes only.

     Input parameters:
       mail_protocol - Mail sending protocol. Possible values: smtp, smtp_over_tsl, smtp_over_ssl.
       mail_host - SMTP server host.
       mail_port - SMTP server port.
       mail_user - SMTP server username.
       mail_password - SMTP server password.
       mail_from - Mail sender address.
       mail_to - Mail recipient address.
       mail_subject - Mail subject.
       mail_text - Mail body, as text.
     -->

    <script><![CDATA[
        import com.workfusion.odf.core.Intake;
        import com.workfusion.odf.core.MailModule;
        import com.workfusion.odf.service.mail.impl.javax.SMTPEmailSender;

        def params = [:];
        params.put(MailModule.PARAM_PROTOCOL, mail_protocol.toString());
        params.put(MailModule.PARAM_HOST, mail_host.toString());
        params.put(MailModule.PARAM_PORT, mail_port.toString());
        params.put(MailModule.PARAM_USER, mail_user.toString());
        params.put(MailModule.PARAM_PASSWORD, mail_password.toString());

        Intake intake = Intake.init(binding).params(params).get();
        SMTPEmailSender emailSender = intake.getInstance(SMTPEmailSender.class);

        emailSender.sendEmail(mail_from.toString(), mail_to.toString(), mail_subject.toString(), mail_text.toString());
    ]]></script>

    <export include-original-data="true">
    </export>
</config>
