Changeset 502 for trunk/lib/Email.inc.php
- Timestamp:
- Dec 30, 2014 10:24:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Email.inc.php
r500 r502 53 53 */ 54 54 55 class Email { 55 class Email 56 { 56 57 57 58 // Default parameters, to be overwritten by setParam() and read with getParam() … … 244 245 } 245 246 247 /* 248 * Returns the body of the current email. This can be used to store the message that is being sent. 249 * It will use the original template, or the replaced template if it has been processed. 250 * 251 * @access public 252 * @return string Message body. 253 * @author Quinn Comendant <quinn@strangecode.com> 254 * @version 1.0 255 * @since 18 Nov 2014 21:15:19 256 */ 257 public function getBody() 258 { 259 $final_body = isset($this->_template_replaced) ? $this->_template_replaced : $this->_template; 260 // Ensure all placeholders have been replaced. Find anything with {...} characters. 261 if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) { 262 unset($unreplaced_match[0]); 263 $app->logMsg(sprintf('Cannot get email body. Unreplaced variables in template: %s', getDump($unreplaced_match)), LOG_ERR, __FILE__, __LINE__); 264 return false; 265 } 266 return $final_body; 267 } 268 246 269 /** 247 270 * Send email using PHP's mail() function. … … 295 318 // Ensure all placeholders have been replaced. Find anything with {...} characters. 296 319 if (preg_match('/({[^}]+})/', $final_body, $unreplaced_match)) { 297 $app->logMsg(sprintf('Cannot send email. At least one variable left unreplaced in template: %s', (isset($unreplaced_match[1]) ? $unreplaced_match[1] : '')), LOG_ERR, __FILE__, __LINE__); 320 unset($unreplaced_match[0]); 321 $app->logMsg(sprintf('Cannot send email. Unreplaced variables in template: %s', getDump($unreplaced_match)), LOG_ERR, __FILE__, __LINE__); 298 322 return false; 299 323 }
Note: See TracChangeset
for help on using the changeset viewer.