diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-08 12:34:19 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-08 12:34:19 +0800 |
commit | 4e38e38c07256bef837af823445de794c3702889 (patch) | |
tree | 2a62e08b3220b921b3c2d6a331db70485bc8dc51 /blog | |
parent | 78083da2c29ef4554e4e873dc078b44c0de06514 (diff) | |
download | pttbbs-4e38e38c07256bef837af823445de794c3702889.tar pttbbs-4e38e38c07256bef837af823445de794c3702889.tar.gz pttbbs-4e38e38c07256bef837af823445de794c3702889.tar.bz2 pttbbs-4e38e38c07256bef837af823445de794c3702889.tar.lz pttbbs-4e38e38c07256bef837af823445de794c3702889.tar.xz pttbbs-4e38e38c07256bef837af823445de794c3702889.tar.zst pttbbs-4e38e38c07256bef837af823445de794c3702889.zip |
forward comments to mail
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1042 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'blog')
-rwxr-xr-x | blog/blog.pl | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/blog/blog.pl b/blog/blog.pl index c4984e7c..e3a91126 100755 --- a/blog/blog.pl +++ b/blog/blog.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: blog.pl,v 1.29 2003/07/08 04:09:36 in2 Exp $ +# $Id: blog.pl,v 1.30 2003/07/08 04:34:19 in2 Exp $ use CGI qw/:standard/; use lib qw/./; use LocalVars; @@ -14,12 +14,13 @@ use DBI; use DBD::mysql; use POSIX; use MD5; +use Mail::Sender; use vars qw/@emonth @cnumber %config %attr %article %th $dbh $brdname/; sub main { - my($fn, $y, $m, $d); + my($fn, $y, $m, $d, $ofn); my($tmpl); $dbh = undef; @@ -33,8 +34,8 @@ sub main print header(-status => 400); return; } - if( !(($brdname, $fn) = $ENV{PATH_INFO} =~ m|^/([\w\-]+?)/([\.,\w]*)$|) || - !( ($fn, $y, $m, $d) = parsefn($fn) ) || + if( !(($brdname, $ofn) = $ENV{PATH_INFO} =~ m|^/([\w\-]+?)/([\.,\w]*)$|) || + !( ($fn, $y, $m, $d) = parsefn($ofn) ) || !(-e "$BLOGDATA/$brdname/$fn") || !(tie %config, 'DB_File', "$BLOGDATA/$brdname/config.db", O_RDONLY, 0666, $DB_HASH) || @@ -251,6 +252,22 @@ sub main param('mail'), param('comment')); if( $name && $comment ){ + if( $attr{"$fn.loadComments"} =~ /\@/ ){ + my $sr = new Mail::Sender{smtp => 'localhost'}; + $sr->MailMsg({from => '批踢踢部落格 <blog@ptt.cc>', + to => $attr{"$fn.loadComments"}, + subject => "您的部落格收到 $name 給您的迴響", + charset => 'big5', + msg => " +您的部落格 http://blog.ptt2.cc/blog.pl/$brdname/$ofn +剛才收到來自 $name <$mail> 給您的迴響 +-------------------------------------------------------------------- +$comment +-------------------------------------------------------------------- + (這封信件是由程式自動發出, 請不要直接回複這封信^^) +", + }); + } dodbi(sub { my($dbh) = @_; my($t, $hash); |