Forums / General / Automaticaly send mail when publishing a new article

Automaticaly send mail when publishing a new article

Author Message

Jeremy B.

Thursday 25 June 2009 4:57:39 am

Hi all,

For one of my website, i will have to send an email when a new article, or other custom classes objects, are published from admin area.

Unless I have a little experience with EZP, I really don't know how I could achieve this.

What I think is :

1/ Modify the User class, to save if a user wants to receive this mail or not

2/ Execute "something" when an editor click on the Send to publication button

3/ This script will check the users, select which ones want to receive the mail, and send it. The script will need some informations about the object that has just been published (at least, title and URL I think)

But I don't know how to do it :(
Can anyone suggest me how he would achieve this ?

Any help would be greatly appreciated :)
Thank you very much.

Julien Plesniak

Thursday 25 June 2009 5:11:47 am

hello,
you have to create a workflow and apply it to the trigger publish/after
and the workflow send the mail to your users

Jeremy B.

Thursday 25 June 2009 9:14:30 am

Thanks for your response, Julien :)

If I understand well, I'll have to create my <i>own</i> workflow, right ?

And btw, how can I create a workflow that will be available for the Publish/After event ?
I created a Event/Approve workflow, but it's only available for Publish/Before event, and I can't find any info about this point.

Thanks for your time !

Friday 26 June 2009 12:06:02 am

Depending on the level of customizability that you need, you might not need a workflow.

You could use the notifications feature:

http://ez.no/doc/ez_publish/technical_manual/4_0/features/notifications

Individual users would subscribe to receive e-mail notifications whenever there have been modifications to a subtree.

If you want to externally manage an e-mail list, you could also use the "tipafriend" feature to manually notify a list whenever there's an article that they should check out:

http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/views/tipafriend

The documentation on that isn't so good, but basically you would access content/tipafriend/<node_id> to access a form where you could e-mail someone (or a mailing list of course) about that node.

Jeremy B.

Tuesday 30 June 2009 1:22:40 am

Thanks for your answer Peter :)

Indeed, the notification feature could be more suitable for my need.

In detail, the features I need on my site are :

- A user subscribe to have a notification for each article published on the site. For that, I think the notification feature would be nice.
I just hope that I could tell eZ that the user will subscribe to more than just one subtree. I mean for example, the subtree "News" and the subtree "Products" at the same time.
Is that possible ? Or do you think I will need to create my own workflow ?

- A user subscribe to receive notification once a month. I think that I will run a cronjob once a month, that will check articles to send in different subtrees, get the subscribers list, and send it.
Do you agree with my point of view ?

Many thanks for your time :)