I have a requirement where i need to trigger a mail when page is delivered to publishing target with the page links and some title and description in the mail body.
What is the best approach to proceed in this scenario. I have tried using Replication Handler but that doesn't give me event when the page is delivered to target it raises the event only when it is activated not delivered.
Pleas help me to find best approach to this problem.
1.It should be triggered on modified event under /content/yourproject
2.it should be triggered on publish environment only
and from the workflow payload you will get the page details that you can use to send a mail from workflow only and since you are triggering all those things from publish you have the activation process also complete.
But does this listener knows when page is completely replicated in target publish instance? As far as i know it will only listen to jcr node property update/add/remove etc. However jcr:lastReplicationAction is Activated also when you publish a page and it is in pending state so it doesn't gives conclusive evidence that the page is published to target instance.
You could use a Resource Listener on your publisher to listen for changes in the JCR and send the emails accordingly. If you created your AEM project with a Maven archetype, it should have generated a SimpleResourceListener.java file for you. Check it out to see how it works. Basically, any time a resource is modified, a line is logged. Of course you could narrow down the listener (only to /content/your-project for example) and change it to send a mail instead.