Project

General

Profile

1
<?php
2

    
3
// $Id$
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2007, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
/*
27

    
28
wbmailer class
29

    
30
This class is a subclass of the PHPMailer class and replaces the mail() function of PHP
31

    
32
*/
33

    
34
// Include PHPMailer class
35
require_once(WB_PATH."/include/phpmailer/class.phpmailer.php");
36

    
37
class wbmailer extends PHPMailer 
38
{
39
	// new websitebaker mailer class (subset of PHPMailer class)
40
	// setting default values 
41

    
42
	function wbmailer() {
43
		// set method to send out emails
44
		if(defined('WBMAILER_SMTP_HOST')) {
45
			// sets Mailer to send messages using SMTP
46
			$this->IsSMTP();                                            
47
			$this->Host = WBMAILER_SMTP_HOST;                        // use STMP host defined in config.php
48
		} else {
49
			// set Mailer to send message using PHP mail() function
50
			$this->IsMail();
51
		}
52

    
53
		// set language file for PHPMailer error messages
54
		if(defined("LANGUAGE")) {
55
			$this->SetLanguage(strtolower(LANGUAGE),"language");     // english default (also used if file is missing)
56
		}
57

    
58
		// set default charset
59
		if(defined('DEFAULT_CHARSET')) { 
60
			$this->CharSet = DEFAULT_CHARSET; 
61
		} else {
62
			$this->CharSet='utf-8';
63
		}
64

    
65
		// set default sender name
66
		if (isset($_SESSION['DISPLAY_NAME'])) {
67
			$this->FromName = $_SESSION['DISPLAY_NAME'];             // FROM NAME: display name of user logged in
68
		} else {
69
			$this->FromName = "WB Mailer";                           // FROM NAME: set default name
70
		}
71

    
72
		// set default sender mail address
73
		if (isset($_SESSION['EMAIL'])) {
74
			$this->From = $_SESSION['EMAIL'];                        // FROM MAIL: (of user logged in)
75
		} else {
76
			$this->From = SERVER_EMAIL;                              // FROM MAIL: (server mail)
77
		}
78

    
79
		// set default mail formats
80
		$this->IsHTML(true);                                        
81
		$this->WordWrap = 80;                                       
82
		$this->Timeout = 30;
83
	}
84
}
85

    
86
?>
(7-7/12)