thnx,Charly
Email Notification is one of the best things coming from CalendarScript 3.2. The only thing is that version isn't out yet. So, I've written a small plugin that will handle email for you, but only when an event is added. It is very trivial, though, to make it respond to any event by sending an email. Just copy the after_add_event.pl to after_edit_event.pl, and change the name of the function in the file to match. That should be all you have to do to get it to email you both after additions and edits. I know, a good plugin should be a lot more useful and let you decide which events to respond to from the Admin Interface, but this is just a "quick 'n dirty" fix until Matt gets 3.2 finished. The file is at http://www.csworkbench.com/CSMods/EmailNotify.tar.gz .
Enjoy!David
P.S. The plugin only sends email if the new event needs approving. This is all I'm using it for, so I didn't want my mailbox filling up with "Somebody just added an event" emails. To make it send email if ANYBODY adds anything, just delete the first if statement in the function, as well as it's accompanying close bracket (right after "close MAIL")
------------------
Thanks!
This hack works fantastic! Thanks David!
ok impala!
I like the sendmail notification plugin for 3.1 but I have some questions. I see that you have another calendar_settings.html like the one in the calendarscript/templates/admin/English folder. Does this go into the plugins directory? Does everything in your zip file go there? What are the permissions, 777? And will activating the plugin direct the script to find the new calendar_settings.html in the plugins directory? Or Do I overwrite the one in the English directory?
Also, I see in your message that you made two similar .pl files. The one included and another duplicate for editing notification. Both of these go into the plugins directory I assume?
I'm not a programmer, but I can follow directions quite well. I just need a more explicit explanation. Mainly because I don't want to screw anything up!
Oh yeah, When you say to remove the first "if" line in after_add_event.pl and after_edit_event.pl to just e-mail any event, not approval only events I see another bracket after the one directly after close MAIL. Am I correct to assume the very first bracket before the "if" line stays as well as the very last bracket on the line above the "1;"?
I think that about does it!! I would really like this to work for me. Any help would be great!!!
Thank You very much,Rob
I was in kind of a hurry when I got that EmailNotify plugin out. I am going to put full installation directions for both plugins and templates on my site as soon as I get a chance. But here's some more directions for now. Due to Matt's great script, unzipping that file into the plugins directory is all the file placing you have to do. The archive has the correct directory structure in it (Everything goes in plugins/EmailNotify). As soon as you enable the plugin, the CalendarScript will find the new calendar_settings.html and use it instead of the default one.
Changing all permissions to 777 should be just fine, unless your webserver doesn't like that, in which case you might need to use 755.
All files associated with this plugin will go in the same directory (EmailNotify under plugins). Don't forget, if you copy after_add_event.pl to after_edit_event.pl, you also need to change:sub after_add_event() {to sub after_edit_event() {in the new file.
As for the if line, you will notice it has one open bracket at the end of the line. This pairs with the one directly after close MAIL. The one before the if line and the one before 1; are still needed to mark off where the function begins and ends. So, yes, leave those in.
I believe that answered all your questions. Let me know if you have any more.David
------------------ http://www.csworkbench.com/" TARGET=_blank>http://www.uabcm.com/http://www.csworkbench.com/
I have several calendars and only need this on one of them, is there a way to limit this to just one calendar??
Thanks
You can put the line:
return unless ($calendar eq 'default');
at the top of the after_add_event sub in the file after_add_event.pl to only send emails for the default calendar. Or you can wait until I finish EmailNotify2, which will support user specific and calendar specific email options, so each user will be able to decide when they get emails, what kind they get, and for which calendars they get them. With a little luck, I'll have it finished before I go home for Easter on Wednesday.
David
------------------David Whittaker http://www.uabcm.com/ http://www.csworkbench.com/
Regards! -Toby
------------------If I can count on my friends, why did God give me fingers?
- W. T. Pooh
I got very impressed by your plugin, Fantastic nice job you are doing for all of us! Thank you!
One thing, though, I do not like that the mail I get is in form of a html-attachment.I am just starting to learn perl, maybee my question is a little stupid:Is it the plugin (and if so can I change it?) or is it the server or someting there, which make the mail to html?
Otto
P.S. Sorry, I am one of them who want mail sendt every time an event is added :-) So I am looking forward :-)Thank you! Wonderfull!
print MAIL "Content-type:text/html\n\n";
to:
print MAIL "Content-type:text/plain\n\n";
That line is near the bottom of the subroutine in after_add_event.pl.
Toby: I have included the ability to change the path to sendmail by placing it at the bottom of the Calendar Settings page. I definitely see how this could be a security hole, but since the only people who can change this path have to have permissions to change the calendar setup, I would assume the administrator trusts them. In the next version, I'll allow options for sending via sendmail, smtp, or ntsendmail (the last two are perl modules). It seems like smtp would work from any server that sendmail would work from, though. So should I stop supporting sendmail to leave out the security hole?
CODE:
print MAIL "From: Calendar <username\@yourcompany.com>\n";
Also one note about the sendmail security concern. If you are concerned about this you can always hard code it into the after_add_event.pl instead of letting it be entered from the plug-in screen.
[This message has been edited by Jason S (edited April 01, 2002).]
The reason I didn't put a Reply-to or a From field was because it didn't make sense to me that you would want to reply to the calendar. I'll put that in version 2, though.
As far as security on the path to sendmail is concerned, I've decided to make that appear only if you are Administrator and no one else, even if you have the administrative email permission set. That should keep that rather sensitive field out of the hands of anyone but the calendar creator and whoever he feels is trustworthy enough to get that password.