commit da145c742b1082a6952f3120ed72daac2cea05cc
parent 54730b8950ff188cfadc1dfd462fbb1b5f6ad939
Author: dankert <devnull@localhost>
Date: Thu, 16 Nov 2006 20:59:57 +0100
Diverse Erweiterungen
Diffstat:
1 file changed, 32 insertions(+), 9 deletions(-)
diff --git a/serviceClasses/Mail.class.php b/serviceClasses/Mail.class.php
@@ -8,33 +8,43 @@ class Mail
var $from = '';
var $to = '';
var $bcc = '';
+ var $cc = '';
var $subject = '';
var $text = '';
var $header = array();
+ var $nl = "\n";
+
/**
* Konstruktor.
*/
- function Mail( $mail,$subject='USER_MAIL_SUBJECT',$text='' )
+ function Mail( $to='',$text='common',$xy='' )
{
global $conf;
if ( !empty($conf['mail']['from']) )
$this->from = $conf['mail']['from'];
$this->header[] = 'X-Mailer: '.OR_TITLE.' '.OR_VERSION;
- $this->subject = lang('USER_MAIL_SUBJECT');
- $this->to = '';
+ $this->subject = lang( 'mail_subject_'.$text );
+ $this->to = $to;
- $nl = "\n";
- $this->text = wordwrap(lang($text),70,$nl);
+ $this->text = wordwrap(lang('mail_text_'.$text),70,$this->nl);
// Signatur anhaengen (sofern konfiguriert)
if ( !empty($conf['mail']['signature']) )
{
- $this->text .= $nl.$nl.'-- '.$nl;
- $this->text .= str_replace(';',$nl,$conf['mail']['signature']);
+ $this->text .= $this->nl.$this->nl.'-- '.$this->nl;
+ $this->text .= str_replace(';',$this->nl,$conf['mail']['signature']);
}
+
+ // Kopie-Empfänger
+ if ( !empty($conf['mail']['cc']) )
+ $this->bcc = $conf['mail']['cc'];
+
+ // Blindkopie-Empfänger
+ if ( !empty($conf['mail']['bcc']) )
+ $this->bcc = $conf['mail']['bcc'];
}
@@ -43,7 +53,7 @@ class Mail
*/
function setVar( $varName,$varInhalt)
{
- $this->text = str_replace( $varName, $varInhalt, $this->text );
+ $this->text = str_replace( '{'.$varName.'}', $varInhalt, $this->text );
}
@@ -52,8 +62,21 @@ class Mail
*/
function send()
{
+ // Header um Adressangaben ergänzen.
+ if ( !empty($this->from ) )
+ $this->header[] = 'From: '.$this->from;
+
+ if ( !empty($this->cc ) )
+ $this->header[] = 'Cc: '.$this->cc;
+
+ if ( !empty($this->bcc ) )
+ $this->header[] = 'Bcc: '.$this->bcc;
+
// Mail versenden
- mail($this->to,lang($this->subject),$this->text,$this->header);
+ mail( $this->to, // Empfänger
+ lang($this->subject), // Betreff
+ $this->text, // Inhalt
+ implode($this->nl,$this->header) );
}
}