Send email via task and groovy script

Hi all !

I created a groovy script which remove oldest components of a maven release repo. It is schedule by a task in Nexus administration.

I want to improve this script by sending notification of incoming deletion (some days before).

My issue : how could i send email from this script ?
I tried:

import javax.mail.*
import javax.mail.internet.*


    private boolean sendMail(){
            def d_email = "",
            d_host = "smtpo365",
            d_port  = "25",
            m_to = "",
            m_subject = "Testing",
            m_text = "Hey, this is the testing email."

            def props = new Properties()
            props.put("mail.smtp.user", d_email)
            props.put("", d_host)
            props.put("mail.smtp.port", d_port)
            props.put("mail.smtp.debug", "true");
            props.put("mail.smtp.auth", "false")
            props.put("mail.smtp.socketFactory.port", d_port)
            //props.put("mail.smtp.socketFactory.class", "")
            props.put("mail.smtp.socketFactory.fallback", "false")

            def auth = new SMTPAuthenticator()
            def session = Session.getInstance(props, auth)

            def msg = new MimeMessage(session)
            msg.setFrom(new InternetAddress(d_email))
            msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to))

            Transport transport = session.getTransport("smtps");
            transport.connect(d_host, d_port);
            transport.sendMessage(msg, msg.getAllRecipients());


Result :
unable to resolve class SMTPAuthenticator
def auth = new SMTPAuthenticator()

Do somebody have an idea of my mistake or a way to do this email sending ?

Thanks alot !

Something working…

import org.apache.commons.mail.SimpleEmail

    def emailMgr = container.lookup(EmailManager.class.getName());
    SimpleEmail email = new SimpleEmail();
    email.setSubject("Nexus release clean-up task");
    email.setMsg("This is a test mail ... :-)");

I’m trying to go further : using org.apache.commons.mail.HtmlEmail

Then this error is throwed :
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/alternative

Maybe something like that could work : groovy - Sending an email: no object DCH for MIME type multipart/mixed - Stack Overflow ?