improvement for mail composition (disabled text version to avoid problems with some...
[brisk.git] / web / Obj / mail.phh
1 <?php
2 include_once 'Mail.php';
3 include_once 'Mail/mime.php';
4
5 $brisk_mail_hp = array( "text_charset"  => "utf-8",
6                         "html_charset" => "utf-8",
7                         "header_charset" => "utf-8",
8                         "eol" => "\n" );
9
10 // references: <alfanum-8-chars>@<domain>
11 function brisk_mail($to, $subject, $text, $html)
12 {
13     GLOBAL $brisk_mail_hp, $G_admin_mail;
14
15     $hdrs = array(
16               'From'    => $G_admin_mail,
17               'Subject' => $subject
18               );
19     // if ($refs != Null)
20     //    $hdrs['References'] = $refs;
21
22     $mime = new Mail_mime($brisk_mail_hp);
23
24     // disabled to avoid client problems
25     // $mime->setTXTBody($text);
26     $mime->setHTMLBody($html);
27
28     $body = $mime->get();
29     $hdrs = $mime->headers($hdrs);
30
31     $mail = Mail::factory('mail');
32
33     $mail->send($to, $hdrs, $body);
34
35     return TRUE;
36 }
37 ?>