Hello everyone, I'm trying to send an automatic email and this is the idea I have had.
I used the "Groovy Notification Tutorial" (http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyNotificationTutorial) and instead of writing in a file, I try to send an email. This is my code (I only copy the method onEvent, I didn't change the rest) : void onEvent(Event event, Object source, Object data) { // Prevent infinite recursion since in this example we log to wiki page which // triggers a document change... :) if (source.fullName != "Main.Logger") { def sender = context.user.substring(6) def emailcc = xwiki.null def emailbcc = xwiki.null def pageattachments = [] def emailcontent = "Test" def result = xwiki.mailsender.sendHtmlMessage("${sender}", "n...@gmail.com", emailcc, emailbcc, "Test du mail", emailcontent, document.getContent(), pageattachments) def document = xwiki.getDocument("Main.Logger") document.setContent("Sender : ${sender} / Content : ${emailcontent}") document.save("Logging event", true) } } But when I try this, nothing happened. I don't have any error message so I don't know if I make something wrong. Do you have an idea of how doing this ? Thank you very much for your future answer, Stéphanie -- View this message in context: http://xwiki.475771.n2.nabble.com/Send-an-email-in-an-event-listener-tp7579175.html Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users