I'm really sorry, I don't understand all this kind of specific words ^^ Do you want the entire code ? Or what do you want exactly ? In any case, thanks for your answer, Stéphanie 2012/5/29 vmassol [via XWiki] <[email protected]>
On May 29, 2012, at 1:07 PM, Stéphanie Roulland wrote:
Hello,
Thank you for your answer, but I'm sorry, I don't understand what you mean by CM.
Component Manager.
-Vincent
Thanks, Stéphanie
2012/5/29 Vincent Massol <[hidden email]<http://user/SendEmail.jtp?type=node&node=7579201&i=0>>
FYI I've just done this in a training I gave last week and it worked nicely.
Can you show us the code you've used to register the event listener against the CM?
Thanks -Vincent
On May 29, 2012, at 9:12 AM, Stéphanie wrote:
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}", "[hidden email] <http://user/SendEmail.jtp?type=node&node=7579201&i=1>", 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
users mailing list [hidden email] <http://user/SendEmail.jtp?type=node&node=7579201&i=2> http://lists.xwiki.org/mailman/listinfo/users
------------------------------ If you reply to this email, your message will be added to the discussion below:
http://xwiki.475771.n2.nabble.com/Send-an-email-in-an-event-listener-tp75791... To unsubscribe from Send an email in an event listener, click here<http://xwiki.475771.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7579175&code=c3RlcGhhbmllLnJvdWxsYW5kQGdtYWlsLmNvbXw3NTc5MTc1fC0yNDI5MjU2Mjk=> . NAML<http://xwiki.475771.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
-- Stéphanie ROULLAND 06.74.85.37.90 ------------------------- Contrat de professionnalisation DCNS Ingénieur domaine collaboratif 02.29.05.42.23 ------------------------- Elève ingénieur ENIB 3ème année cycle ingénieur Option informatique -- View this message in context: http://xwiki.475771.n2.nabble.com/Send-an-email-in-an-event-listener-tp75791... Sent from the XWiki- Users mailing list archive at Nabble.com.