Forums / Developer / Pressing bulk mail issue

Pressing bulk mail issue

Author Message

Rinze Cats

Tuesday 08 June 2004 12:23:03 am

Hi all!

I need to implement a bulkmail sollution for sending a newsletter in ezpublish 3.3.5. I have searched the forum, but to no avail. I have also tried the workflow extension that is submitted to this site, but can't quite get it to work.

Since I have no experience in writing an extension, this could take me forever to implement. There must be some other way. What I want to achieve is that a published page is send to all newsletter subscribers, when a certain action is performed by the site editor. (nothing special really).

All help is greatly appreciated!

rinze

Paul Forsyth

Tuesday 08 June 2004 4:28:51 am

Notifications should help you here. All you need to do is ensure all your users watch for notifications on the particular page you are interested in.

Have you tried this approach?

paul

--
http://www.visionwt.com

Rinze Cats

Tuesday 08 June 2004 4:46:10 am

Hi paul, thanx for the swift reply.

Could you perhaps explain in more detail how to go about it using the notification module?

The site is an online magazine. When a new issue is published, the homepage should be sent to all newsletter subscribers, but not necessarily at the same time the homepage is published. The editor should also be able to 'manage' the subscribers: add and remove them manually for instance?

thanx again
rinze

Sebastian Sprenger

Wednesday 09 June 2004 2:58:01 am

Hi Rinze!

I also implemented a newsletter using notification. I did it this way:
1. I generated a workflow on the event 'create user'
2. The workflow has a little script, that subscribes every new user to a special folder; the script does the same as the button "keep me updated" on a side. Result is, that every new user will be notificated about changes within a folder I called 'newsletter'.
3. Generate an object (e.g. type article) and save it into the folder. All users, that have subscribed to this folder (meaning ALL users), recieve the change via email.
4. You have a newsletter!

Hope this could be understood, if you're interested I could post more.

Sebastian

Rinze Cats

Wednesday 09 June 2004 3:06:34 am

Hi sebastian!

I'll try to implement it using the information given. When (if) i run into problems, i'll try and contact you through the forum!

thanx for the help, i should get this to work!

Paul Forsyth

Wednesday 09 June 2004 3:32:39 am

When you subscribe users to a node remember it does not always need to be a special folder. It can be the home page, or any other part of your site.

The notification you will use for this will be a subtree notification so be aware that any changes underneath your chosen node will also trigger the notification. The use of a leaf node (with no children) such as a special folder would obviously be the best choice in your case i believe.

good luck!

paul

--
http://www.visionwt.com

Björn Dieding@xrow.de

Wednesday 09 June 2004 3:57:08 am

Use phplist http://tincan.co.uk/phplist

It works quite well

bjoern
-
http://www.xrow.de

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Rinze Cats

Wednesday 09 June 2004 7:04:58 am

I am running ezpublish on a windows system, so by the looks of it, phplist is not an option.

Regarding the user register event: I would have to create this event myself? And: Since I also am running a forum on this site for which users can automatically register, won't this trigger the 'create new user' event as well (unwanted)?

Sebastian Sprenger

Wednesday 09 June 2004 9:05:53 am

Yes, when both kinds of users have the same content class the trigger will start the script unwanted. But perhaps the two user differ in some attributes, so you can let the script decide if notification is set or not. To read the attributes of an object is not difficult.

The script has to be written by you, you have to create a new Event. If you like, perhaps I could post or mail my source. But therefore I have to ask a colleage to post the code because I'm not working on eZ any more. This couldn't be done bevore friday, on thursday there is holiday in germany.

Contact me on this forum if I could help you further more.

Rinze Cats

Thursday 10 June 2004 2:39:55 am

since I have no experience in creating events myself, it might help me a great deal to use your code at least as a guide. by the looks of, you could make this a lot easier for me ;-)

I can be contacted at rinze[dot]cats[at]planet[dot]nl

greetz rinze

Silke Fox

Monday 14 June 2004 12:27:09 am

Hi Rinze,

this is the code snippet from Sebastian's event type.

...
function execute( &$process, &$event ) 
{
    eZDebug::writeNotice("Start","Workflow clubapplication");
		
    // get object and object id
    $parameters = $process->attribute( 'parameter_list' );
    $object =& eZContentObject::fetch( $parameters['object_id'] );
    $objectId= $parameters['object_id'];
		
    // add user to newsletter-notification Folder "Community-Newsletter" NodeID 1177
    include_once( 'kernel/classes/notification/handler/ezsubtree/ezsubtreenotificationrule.php' );
    $nodeIDList =& eZSubtreeNotificationRule::fetchNodesForUserID( $objectId, false );
    $nodeID = 1177;
    if ( !in_array( $nodeID, $nodeIDList ) ) 
    {
	eZDebug::writeNotice("NotificationRule","Workflow clubapplication");
	$rule =& eZSubtreeNotificationRule::create( $nodeID, $objectId );
	$rule->store();
    }
}
...

In our example this event is set up as multiplexer for content class "User", trigger is "content create after".
Users are able to modify their "newsletter" settings within the notification settings (/notfication/settings).
What is still missing for you is that editors can handle other user's notification settings. No idea if anybody already worked on this.

hth
Silke

James Ward

Monday 14 June 2004 9:12:36 am

This looks like just what I'm after. Could you include more of the code here? I'm not sure I have the includes and the class definition correct. If this is already posted somewhere please supply a link or email me at letsgoleafs[at]hotmail[dot]com.

Thanks.

working at www.wardnet.com
blogging at www.jamesward.ca

Silke Fox

Tuesday 15 June 2004 4:27:19 am

It was almost complete... just missing the default event stuff.

<?php

define( "EZ_WORKFLOW_TYPE_CLUBAPPLICATION_ID", "clubapplication" );
include_once("kernel/classes/ezworkflowtype.php");

class clubapplicationtype extends eZWorkflowEventType
{
    function clubapplicationtype() 
    {
        $this->eZWorkflowEventType( EZ_WORKFLOW_TYPE_CLUBAPPLICATION_ID, "Club Application" );
    }

    function execute( &$process, &$event ) 
    {
	eZDebug::writeNotice("Start","Workflow clubapplication");
	
	// see last posting...

    }	
}

eZWorkflowEventType::registerType( EZ_WORKFLOW_TYPE_CLUBAPPLICATION_ID, "clubapplicationtype" );

?>

The function "execute" defines what that event actually does.
If you want to rename the event type, you have to change the first and last line (define and registerType) and the class name. And take care of directory structure.

See also http://ez.no/ez_publish/documentation/development/extensions/workflow_events/creating_a_new_event
and the wrapping event as example
http://ez.no/ez_publish/documentation/development/extensions/workflow_events/wrapping_event

Good luck,
Silke

Rinze Cats

Wednesday 16 June 2004 3:41:56 am

mm, before implementing this sollution I decided to test the notification functionality, but it doesn't seem to work. Sending mail from the server is no problem, tell a friend for instance, functions properly.

No mails are being send, the log of my smtp server has no record of the mails. I tried to manually add a notification for a folder in the admin interface, as well as the 'keep me updated' functionality in my forum. Checking the notification settings in the admin interface for the user (admin , * * * ) all notification entries are in place.

Posting in the forum or publishing in the test folder is not working.

Anybody got an idea what's wrong? I can't find a solution anywhere in this forum!

Alessandro Cipriani

Wednesday 16 June 2004 5:39:58 am

Rinze,

i updated my old 3.3-1 version to 3.3-5 (and then 3.4-0)
using the 3.3-5 i noticed that notification works!
But i saw some difference between 3.4-0 with installer and 3.4-0 'upgraded', so this can be the problem

i'm very interested to what you are trying to do (implementing a mailing list where an administrator can subscribe other users. )
see http://ez.no/community/forum/setup_design/new_notification_type_needed_help

hope we can work togheter
icq # 326-457-502

best regards to all
alessandro

James Ward

Wednesday 16 June 2004 10:50:22 am

Thanks Silke,
One more question, I gather from your post that you added a new trigger for the create function:
> trigger is "content create after".

Will this workflow function if I call it with "content publish after"? Or do I need to write a "create" trigger?

Thanks again.

working at www.wardnet.com
blogging at www.jamesward.ca

Sebastian Sprenger

Thursday 17 June 2004 3:46:22 am

Hi Rinze!

Have you set up the eZ- and the Linux-cronjobs properly?
(e.g. see http://ez.no/ez_publish/documentation/configuration/configuration/cron_jobs)

Sebastian

Silke Fox

Thursday 17 June 2004 3:48:48 am

Sorry James, my mistake...
It is "content publish after".
No idea how to create a new trigger, anyway... ;)

Rinze Cats

Monday 21 June 2004 2:17:39 am

Hi guys,

Notifications are functioning, so I started implementing the code presented above. I have two questions:

1. from the code I can't see the relation to the 'create user event'? The following sentence probably explains this, but I simply don't understand! Can't find any documentation on the multiplexer for that matter!
<"In our example this event is set up as multiplexer for content class "User",>

So I guess my first question is, how do I do this?

2. Secondly, if I were to send the newsletter, would it be possible to isolate the rule for the newsletter? Using the execute notification filter from the admin interface executes all rules available.

sorry for the great load of questions, i am really trying to understand the notification and event system.

@allesandro: i'll have to create an icq account first. I'll contact you later?

Alessandro Cipriani

Monday 21 June 2004 2:36:16 am

hi rinze
the multiplexer event should work as follows (please people correct me if i'm in error):

-you have to create another workflow (as the one you want to create that 'does something')
-after you create a separate workflow with the multiplexer event, and there you start the first workflow only for certain conditions (in our example only if we are working with the user class).

so you link only the multiplexer event with the trigger "publication/after" and you'll run the first workflow only if the new publicated object is an instance of the user class.

in general: multiplexer event can be used as a trigger with many condtions

what are you trying to do is implementing a newsletter where users must subscribe by themselves or where administrator can subscribe other users? i need the second notification type. if this is your case too we can work togheter.

ok for the icq account

best regards
alessandro