How to trigger an email based on span content in page

I have an page and i have referred an username of an xwiki user(it will be in span tag)

When i save the page, i need to trigger an email to the the corresponding username’s email.

Whether it is possible in XWiki?

Referred this link:

But i dont know how to parse the content of page and parse it to send email.

Can anyone share your idea’s regarding this?

One option is to write an event listener in Java for document save, in which you look for the user name in the document XDOM and use the Mail Sender API to send the mail.

Another option is to listen for document save in JavaScript (as indicated in the link you posted), look for the user name in the DOM and make and AJAX request for a server side script that sends the mail (using the same Mail Sender API).

1 Like