Changeset 1044
- Timestamp:
- 07/24/08 08:34:01 (4 months ago)
- Files:
-
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/utils/jMailer.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/CREDITS
r1039 r1044 57 57 - trois plugin swf (#498) 58 58 - plugin coord history (#507) 59 - improvement in jMailer (#530) 59 60 60 61 Loic Mathaud (bballizlife): trunk/lib/jelix/utils/jMailer.class.php
r1026 r1044 12 12 * @subpackage utils 13 13 * @author Brent R. Matzelle 14 * @contributor Laurent Jouanneau 14 * @contributor Laurent Jouanneau, Kévin Lepeltier 15 15 * @copyright 2001 - 2003 Brent R. Matzelle, 2006 Laurent Jouanneau 16 * @copyright 2008 Kévin Lepeltier 16 17 * @link http://www.jelix.org 17 18 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 85 86 */ 86 87 public $Body = ""; 88 89 /** 90 * Use tpl for sets the Body of the message. This can be either an HTML or text body. 91 * If HTML then run IsHTML(true). 92 * @var string 93 */ 94 public $bodyTpl; 87 95 88 96 /** … … 346 354 $this->ReplyTo[$cur][1] = $name; 347 355 } 348 356 357 358 /** 359 * Find the name and address in the form "name<address@hop.tld>" 360 * @param string $address 361 * @return array( $name, $address ) 362 */ 363 function getAddrName($address) { 364 365 preg_match ('`^([^<]*)<([^>]*)>$`', $address, $tab ); 366 array_shift($tab); 367 return $tab; 368 369 } 370 371 /** 372 * Adds a Tpl référence. 373 * @param string $selector 374 * @return void 375 */ 376 function Tpl( $selector ) { 377 378 $this->bodyTpl = $selector; 379 380 } 349 381 350 382 ///////////////////////////////////////////////// … … 362 394 $body = ""; 363 395 $result = true; 396 397 if( isset($this->bodyTpl) && $this->bodyTpl != "") { 398 399 $mailtpl = new jTpl(); 400 $metas = $mailtpl->meta( $this->bodyTpl ); 401 402 if( isset($metas['Subject']) ) 403 $this->Subject = $metas['Subject']; 404 405 if( isset($metas['Priority']) ) 406 $this->Priority = $metas['Priority']; 407 $mailtpl->assign('Priority', $this->Priority ); 408 409 if( isset($metas['From']) ) { 410 $adr = $this->getAddrName( $metas['From'] ); 411 $this->From = $adr[1]; 412 $this->FromName = $adr[0]; 413 } 414 $mailtpl->assign('From', $this->From ); 415 $mailtpl->assign('FromName', $this->FromName ); 416 417 if( isset($metas['Sender']) ) 418 $this->Sender = $metas['Sender']; 419 $mailtpl->assign('Sender', $this->Sender ); 420 421 if( isset($metas['to']) ) 422 foreach( $metas['to'] as $val ) 423 $this->to[] = $this->getAddrName( $val ); 424 $mailtpl->assign('to', $this->to ); 425 426 if( isset($metas['cc']) ) 427 foreach( $metas['cc'] as $val ) 428 $this->cc[] = $this->getAddrName( $val ); 429 $mailtpl->assign('cc', $this->cc ); 430 431 if( isset($metas['bcc']) ) 432 foreach( $metas['bcc'] as $val ) 433 $this->bcc[] = $this->getAddrName( $val ); 434 $mailtpl->assign('bcc', $this->bcc ); 435 436 if( isset($metas['ReplyTo']) ) 437 foreach( $metas['ReplyTo'] as $val ) 438 $this->ReplyTo[] = $this->getAddrName( $val ); 439 $mailtpl->assign('ReplyTo', $this->ReplyTo ); 440 441 $this->Body = $mailtpl->fetch( $this->bodyTpl ); 442 443 } 364 444 365 445 if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
