Skip to content
Snippets Groups Projects
tgImap.class.php 967 B
Newer Older
  • Learn to ignore specific revisions
  • Ubbo Veentjer's avatar
    Ubbo Veentjer committed
    <?php
    
    class tgImap {
    
      var $conf;
      var $sender;
      var $cc;
    
      function __construct( $conf) {
        $this->conf = $conf;
        $this->sender = $conf['imap']['sender'];
        $this->cc = $conf['imap']['cc'];
      }
      
      function mail($to, $subject, $body) {
    
        // Falls eine Zeile der Nachricht mehr als 70 Zeichen enthälten könnte,
        // sollte wordwrap() benutzt werden (http://de.php.net/manual/de/function.mail.php)
        $body = wordwrap($body, 70);
        
        $header = 'From: '. $this->sender . "\n" .
                  'Reply-To: '. $this->sender . "\n" .
                  'Cc: ' . $this->cc . "\n" .
                  'X-Mailer: PHP/' . phpversion() . "\n" .
                  'MIME-Version: 1.0' . "\n" .
                  'Content-type: text/plain; charset=UTF-8' . "\n".
                  'Content-Transfer-Encoding: 8bit' . "\n";
    
        // replace linebreaks on www.textgrid.de
        $body = str_replace("\r\n", "\n", $body);
        
        mail($to, $subject, $body, $header);
        
      }
    
    }
    
    ?>