I want to send an email message from a scheduled job. The job scheduler requires groovy scripts. I found some velocity code snippets in https://extensions.xwiki.org/xwiki/bin/view/Extension/Mail/MailSenderAPI
and also a ‘Using from Java’-section. When I copy/paste the java code in a groovy macro, I get some error messages like
unable to resolve class Inject for annotation
After adding
import org.xwiki.mail.*;
import javax.inject.*;
import javax.mail.*
import javax.mail.internet.*;
I get the error message:
Annotation @javax.inject.Inject is not allowed on element LOCAL_VARIABLE
in the lines
@Inject MailSenderConfiguration configuration;
@Inject @Named("text/html") MimeBodyPartFactory htmlPartFactory;
@Inject MailSender mailSender;
@Inject @Named("database") MailListener databaseMailListener;
Hints to solve this problem?