Fix ML templates inclusion path
[platal.git] / modules / xnetgrp / mail.inc.php
index 3d55413..b03865d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -93,13 +93,13 @@ function _send_xnet_mail($user, $body, $mailer, $replyto = null)
         $mailer->addHeader('Reply-To', $replyto);
     }
     $mailer->setTxtBody(wordwrap($text, 72));
-//    $mailer->send();
+    $mailer->send();
 }
 
 // }}}
 // {{{ send_xnet_mails
 
-function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null)
+function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null, $attach = null)
 {
     global $globals;
     $sent = array();
@@ -107,6 +107,11 @@ function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null)
     $mailer = new PlMailer();
     $mailer->setSubject($sujet);
     $mailer->setFrom($from);
+    if (is_uploaded_file($attach['tmp_name'])) {
+        $mailer->addAttachment($attach['tmp_name'],
+                               $attach['type'],
+                               $attach['name']);
+    }
 
     foreach ($tos as $user) {
         if ($sent[$user['email']]) continue;