Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2 3   Go Down
Print
Author Topic: Email notification  (Read 2253 times)
0 Members and 1 Guest are viewing this topic.
Charly
Guest
« on: March 13, 2002, 10:01:00 AM »

Hi!
I'm not a real Perl expert, but can somebody tell me how to add an automatic email-notification after a new event has been created or edited?

thnx,
Charly

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #1 on: March 14, 2002, 03:21:00 AM »

Hey 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")

------------------

Logged

Charly
Guest
« Reply #2 on: March 14, 2002, 09:58:00 AM »

Cheers!
I'll give it a whirl right now and let you know how it worked out!

Thanks!

Logged
okimpala
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: March 18, 2002, 07:29:00 AM »

Superb,

This hack works fantastic! Thanks David!  

ok impala!

------------------

Logged
rob
New Member
*

Karma: 0
Offline Offline

Posts: 0

various


WWW
« Reply #4 on: March 21, 2002, 12:06:00 PM »

Hey there Tuba Dave,

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

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #5 on: March 21, 2002, 02:00:00 PM »

Hey, 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/

Logged

Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« Reply #6 on: March 25, 2002, 01:20:00 PM »

Great plugin.

I have several calendars and only need this on one of them, is there a way to limit this to just one calendar??

Thanks

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #7 on: March 25, 2002, 02:07:00 PM »

Hey Jason,

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/  


Logged

Marc
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer tech


WWW
« Reply #8 on: March 27, 2002, 03:41:00 PM »

Sorry, but however it doesn't work.
Where's my error?
Normaly every works with my sendmail-settings.
Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #9 on: March 27, 2002, 09:58:00 PM »

Did you use the secure path to sendmail (usually /usr/sbin/sendmail)?

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

Rufus
New Member
*

Karma: 0
Offline Offline

Posts: 0

Childrens Entertainer, Web Geek


WWW
« Reply #10 on: March 28, 2002, 12:36:00 PM »

Haven't so much as looked at your plugin, there, TubaDave, but in all your wondrous preference options - have you allowed the editing of the path to sendmail? I know this sounds obvious, but this was the HUGE hole in the calendarscript v2 email hack (that and the fact that I neglected to remove my personal email addy from the settings file...)

Regards!
-Toby

------------------
If I can count on my friends, why did God  give me fingers?

- W. T. Pooh

Logged

If I can count on my friends, why did God  give me fingers?

- W. T. Pooh


ooj
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #11 on: April 01, 2002, 03:36:00 AM »

David!

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!

------------------

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #12 on: April 01, 2002, 08:46:00 AM »

Otto:  Sorry about that, you can make it look like plain text by changing the line:

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?

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« Reply #13 on: April 01, 2002, 12:13:00 PM »

Dave,
Plug-in is working great.  I made 1 modification to the after_add_event.pl file which added a "From" field to the e-mail.  Because the program uses the sendmail on my web host the e-mail is from their server so if one of my administrators replied thinking it was going to me it would actually go to never-never land.  If anyone wants the code it is below, just add it after the "To:" field.

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).]

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #14 on: April 01, 2002, 01:28:00 PM »

Hey Jason.

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.  

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

Pages: [1] 2 3   Go Up
Print
Jump to: