Project

General

Profile

« Previous | Next » 

Revision 568

Added by doc almost 17 years ago

Added support to configure the mailer settings via the backend

View differences:

class.wbmailer.php
43 43
		// set mailer defaults (PHP mail function)
44 44
		$db_wbmailer_routine = "phpmail";
45 45
		$db_wbmailer_smtp_host = "";
46
		$db_wbmailer_default_sendername = "WB Mailer";
47
		$db_server_email = SERVER_EMAIL;
46 48

  
47 49
		// get mailer settings from database
48 50
		$database = new database();
......
54 56
			if ($setting['name'] == "wbmailer_smtp_auth") { $db_wbmailer_smtp_auth = (bool)$setting['value']; }
55 57
			if ($setting['name'] == "wbmailer_smtp_username") { $db_wbmailer_smtp_username = $setting['value']; }
56 58
			if ($setting['name'] == "wbmailer_smtp_password") { $db_wbmailer_smtp_password = $setting['value']; }
59
			if ($setting['name'] == "wbmailer_default_sendername") { $db_wbmailer_default_sendername = $setting['value']; }
60
			if ($setting['name'] == "server_email") { $db_server_email = $setting['value']; }
57 61
		}
58 62

  
59 63
		// set method to send out emails
......
62 66
			$this->IsSMTP();                                            
63 67
			$this->Host = $db_wbmailer_smtp_host;
64 68
			// check if SMTP authentification is required
65
			if ($db_wbmailer_smtp_auth && strlen($db_wbmailer_smtp_username) > 1 && strlen($db_wbmailer_smtp_password) > 1) {
69
			if ($db_wbmailer_smtp_auth == "true" && strlen($db_wbmailer_smtp_username) > 1 && strlen($db_wbmailer_smtp_password) > 1) {
66 70
				// use SMTP authentification
67 71
				$this->SMTPAuth = true;     	  								// enable SMTP authentification
68 72
				$this->Username = $db_wbmailer_smtp_username;  	// set SMTP username
......
75 79

  
76 80
		// set language file for PHPMailer error messages
77 81
		if(defined("LANGUAGE")) {
78
			$this->SetLanguage(strtolower(LANGUAGE),"language");     // english default (also used if file is missing)
82
			$this->SetLanguage(strtolower(LANGUAGE),"language");    // english default (also used if file is missing)
79 83
		}
80 84

  
81 85
		// set default charset
......
87 91

  
88 92
		// set default sender name
89 93
		if (isset($_SESSION['DISPLAY_NAME'])) {
90
			$this->FromName = $_SESSION['DISPLAY_NAME'];             // FROM NAME: display name of user logged in
94
			$this->FromName = $_SESSION['DISPLAY_NAME'];            // FROM NAME: display name of user logged in
91 95
		} else {
92
			$this->FromName = "WB Mailer";                           // FROM NAME: set default name
96
			$this->FromName = $db_wbmailer_default_sendername;			// FROM NAME: set default name
93 97
		}
94 98

  
95
/*  some mail provider (lets say mail.com) reject mails send out by foreign mail relays
96
    but using the providers domain in the from mail address (e.g. myname@mail.com)
97
		// set default sender mail address
98
		if (isset($_SESSION['EMAIL'])) {
99
			$this->From = $_SESSION['EMAIL'];                        // FROM MAIL: (of user logged in)
100
		} else {
101
			$this->From = SERVER_EMAIL;                              // FROM MAIL: (server mail)
102
		}
103
*/
104
		$this->From = SERVER_EMAIL;                                // FROM MAIL: (server mail)
99
		/* 
100
			some mail provider (lets say mail.com) reject mails send out by foreign mail 
101
			relays but using the providers domain in the from mail address (e.g. myname@mail.com)
102
		*/
103
		$this->From = $db_server_email;                           // FROM MAIL: (server mail)
105 104

  
106 105
		// set default mail formats
107 106
		$this->IsHTML(true);                                        

Also available in: Unified diff