~kosova/+junk/tuxfamily-twiki

« back to all changes in this revision

Viewing changes to foswiki/lib/Foswiki/Configure/Checkers/MailProgram.pm

  • Committer: James Michael DuPont
  • Date: 2009-07-18 19:58:49 UTC
  • Revision ID: jamesmikedupont@gmail.com-20090718195849-vgbmaht2ys791uo2
added foswiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# See bottom of file for license and copyright information
 
2
package Foswiki::Configure::Checkers::MailProgram;
 
3
 
 
4
use strict;
 
5
 
 
6
use Foswiki::Configure::Checker;
 
7
 
 
8
use base 'Foswiki::Configure::Checker';
 
9
 
 
10
sub check {
 
11
    my $this = shift;
 
12
 
 
13
    return '' if ( !$Twiki::cfg{EnableEmail} );
 
14
 
 
15
    eval "use Net::SMTP";
 
16
    my $n;
 
17
    my $useprog = 0;
 
18
    if ($@) {
 
19
        $n       = "Net::SMTP is <b>not</b> installed in this environment. ";
 
20
        $useprog = 1;
 
21
    }
 
22
    elsif ( !$Foswiki::cfg{SMTP}{MAILHOST} ) {
 
23
        $n = $this->WARN(
 
24
'Net::SMTP is installed in this environment, but {SMTP}{MAILHOST} is not defined, so the {MailProgram} <b>will</b> be used..'
 
25
        );
 
26
        $useprog = 1;
 
27
    }
 
28
    else {
 
29
        $n = $this->NOTE(
 
30
'<em>Net::SMTP is installed in this environment, so this setting will <b>not</b> be used.</em>'
 
31
        );
 
32
        $useprog = 0;
 
33
    }
 
34
    if ($useprog) {
 
35
        my $val = $Foswiki::cfg{MailProgram} || '';
 
36
        $val =~ s/\s.*$//g;
 
37
        if ( !( -x $val ) ) {
 
38
            $n .= $this->WARN("<tt>$val</tt> was not found. Check the path.");
 
39
        }
 
40
    }
 
41
    return $n;
 
42
}
 
43
 
 
44
1;
 
45
__DATA__
 
46
#
 
47
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
 
48
#
 
49
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
 
50
# Foswiki Contributors are listed in the AUTHORS file in the root
 
51
# of this distribution. NOTE: Please extend that file, not this notice.
 
52
#
 
53
# Additional copyrights apply to some or all of the code in this
 
54
# file as follows:
 
55
#
 
56
# Copyright (C) 2000-2006 TWiki Contributors. All Rights Reserved.
 
57
# TWiki Contributors are listed in the AUTHORS file in the root
 
58
# of this distribution. NOTE: Please extend that file, not this notice.
 
59
#
 
60
# This program is free software; you can redistribute it and/or
 
61
# modify it under the terms of the GNU General Public License
 
62
# as published by the Free Software Foundation; either version 2
 
63
# of the License, or (at your option) any later version. For
 
64
# more details read LICENSE in the root of this distribution.
 
65
#
 
66
# This program is distributed in the hope that it will be useful,
 
67
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
68
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
69
#
 
70
# As per the GPL, removal of this notice is prohibited.