-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwritebacknotify
109 lines (73 loc) · 2.65 KB
/
writebacknotify
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Blosxom Plugin: wbnotify
# Author(s): Pasi Savolainen <[email protected]>
# Version: 2003-11-20
# Documentation: See the bottom of this file or type: perldoc wbnotify
# Requirements: writebacks -plugin and a sendmail compatible mailer (most on
# unixen). On Windows, you can use 'Blat', a command-line
# mailer. You can find it here: http://www.interlog.com/~tcharron/blat.html
# (on windows you'll also have to modify the sendmail variable!)
package writebacknotify;
use strict;
# --- Configurable variables -----
# Address that writebacks will be mailed to.
# *** This plugin will not action until you set it. ***
my $wbaddr = '[email protected]';
# Location of sendmail -executable. If default doesn't work, try to find the
# right location and replace this variable with it.
# This may help you find something suitable:
# for i in `locate sendmail`; do if [ -x $i ]; then echo $i; fi; done;
my $sendmail = "/usr/sbin/sendmail";
# --------------------------------
use CGI qw/:standard/;
sub start {
# Only spring into action if POSTing to the writeback plug-in
return 1 unless $writeback::success;
if (open my $mail, "| $sendmail -t") {
my $name = param('name');
my $url = param('url');
my $title = param('title');
my $body = param('comment') || param('excerpt');
print $mail <<"_MAIL_";
From: wbnotify
To: $wbaddr
Subject: [wbnotify] $title
Content-Type: text/plain
X-Mailer: blosxom wbnotify plugin
Your blog got a new comment at
$blosxom::url/$blosxom::path_info:
$name :: $url :
$body
_MAIL_
close $mail;
}
return 1;
}
1;
__END__
=head1 NAME
Blosxom Plug-in: wbnotify
=head1 SYNOPSIS
Provides e-mail notification for WriteBacks, when using Rael's writebacks
plugin.
=head2 QUICK START
Drop this wbnotify plug-in file into your plug-ins directory
(whatever you set as $plugin_dir in blosxom.cgi).
Wbnotify, being a well-behaved plug-in, won't do anything until you set
$wbaddr, which is the email address you want writeback mailed to.
=head1 INSTALLATION
Drop wbnotify into your plug-ins directory ($blosxom::plugin_dir).
=head1 CONFIGURATION
=head2 (REQUIRED) SPECIFYING AN EMAIL ADDRESS
Writeback, being a well-behaved plug-in, won't do anything until you set
$wbaddr.
=head1 AUTHOR
Pasi Savolainen <[email protected]>, http://iki.fi/psavo/
=head1 THANKS
Rael Dornfest
=head1 SEE ALSO
Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
=head1 BUGS
Address bug reports and comments to Pasi Savolainen <[email protected]>.
=head1 LICENSE
This software is licensed similarly to Blosxom.