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 :)

eZ debug

Timing: Jan 29 2025 14:40:57
Script start
Timing: Jan 29 2025 14:40:57
Module start 'content'
Timing: Jan 29 2025 14:40:57
Module end 'content'
Timing: Jan 29 2025 14:40:57
Script end

Main resources:

Total runtime0.1969 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.0703180.8203
Module start 'content' 0.00510.0049 768.890697.7891
Module end 'content' 0.01000.1868 866.6797526.8750
Script end 0.1968  1,393.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.6487200.0002
Check MTime0.00140.7210200.0001
Mysql Total
Database connection0.00060.296510.0006
Mysqli_queries0.154478.38701410.0011
Looping result0.00100.50091390.0000
Template Total0.186594.710.1865
Template load0.00090.469710.0009
Template processing0.185694.229610.1856
Override
Cache load0.00070.334610.0007
Sytem overhead
Fetch class attribute can translate value0.00070.347310.0007
XML
Image XML parsing0.00020.088910.0002
General
dbfile0.00844.2704200.0004
String conversion0.00000.003630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs