Changeset 454 for trunk/lib/Email.inc.php
- Timestamp:
- Jan 4, 2014 3:25:57 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Email.inc.php
r424 r454 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 28 28 * @author Quinn Comendant <quinn@strangecode.com> 29 29 * @version 1.0 30 * 31 30 * 31 32 32 // Example. 33 33 $email = new Email(array( … … 50 50 } 51 51 52 * 52 * 53 53 */ 54 54 class Email { … … 61 61 'headers' => null, 62 62 'regex' => null, 63 63 64 64 // A single carriage return (\n) should terminate lines for locally injected mail. 65 65 // A carriage return + line-feed (\r\n) should be used if sending mail directly with SMTP. 66 66 'crlf' => "\n", 67 67 68 68 // RFC 2822 says line length MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF. 69 69 // http://mailformat.dan.info/body/linelength.html … … 120 120 { 121 121 $app =& App::getInstance(); 122 122 123 123 if (isset($params) && is_array($params)) { 124 124 // Enforce valid email addresses. … … 147 147 { 148 148 $app =& App::getInstance(); 149 149 150 150 if (isset($this->_params[$param])) { 151 151 return $this->_params[$param]; … … 167 167 { 168 168 $app =& App::getInstance(); 169 169 170 170 // Load file, using include_path. 171 171 if (!$this->_template = file_get_contents($template, true)) { … … 191 191 { 192 192 $app =& App::getInstance(); 193 193 194 194 if ('' == trim($string)) { 195 195 $app->logMsg(sprintf('Empty string provided.', null), LOG_ERR, __FILE__, __LINE__); … … 215 215 { 216 216 $app =& App::getInstance(); 217 217 218 218 // Ensure template exists. 219 219 if (!isset($this->_template)) { … … 285 285 $final_body = isset($this->_template_replaced) ? $this->_template_replaced : $this->_template; 286 286 if (false !== $this->getParam('wrap')) { 287 $final_body = wordwrap($final_body, $this->getParam('line_length'), $this->getParam('crlf')); 287 $final_body = wordwrap($final_body, $this->getParam('line_length'), $this->getParam('crlf')); 288 288 } 289 289 … … 320 320 $envelope_sender_header = sprintf('-f %s', $envelope_sender_address); 321 321 } else { 322 $envelope_sender_header = ''; 322 $envelope_sender_header = ''; 323 323 } 324 324 … … 331 331 } 332 332 333 // Send email without 5th parameter if safemode is enabled. 333 // Send email without 5th parameter if safemode is enabled. 334 334 if (ini_get('safe_mode')) { 335 335 $ret = mb_send_mail($final_to, $this->_params['subject'], $final_body, $final_headers); … … 337 337 $ret = mb_send_mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header); 338 338 } 339 339 340 340 // Ensure message was successfully accepted for delivery. 341 341 if ($ret) { … … 345 345 $app->logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $final_to, $this->_params['subject'], str_replace("\r\n", '\r\n', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__); 346 346 return false; 347 } 347 } 348 348 } 349 349 … … 366 366 { 367 367 $app =& App::getInstance(); 368 368 369 369 // If an array, check values recursively. 370 370 if (is_array($email)) {
Note: See TracChangeset
for help on using the changeset viewer.