1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2008 University of California
5//
6// BOINC is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation,
9// either version 3 of the License, or (at your option) any later version.
10//
11// BOINC is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19require_once("../inc/email.inc");
20
21error_page("This feature is deprecated");
22
23$text = get_str('text');
24$subject = get_str('subject');
25
26$user = get_logged_in_user();
27
28page_head(tra("Sending emails"));
29$found = false;
30for ($i=0; $i<6; $i++) {
31    $e = get_str("e$i", true);
32    if (!$e) continue;
33    $found = true;
34    if (function_exists("make_php_mailer")) {
35        require_once("../inc/phpmailer/class.phpmailer.php");
36        $mail = make_php_mailer();
37        $mail->AddAddress($e);
38        $mail->Subject = $subject;
39        $mail->Body = $text;
40        $mail->From = $user->email_addr;
41        $mail->FromName = $user->name;
42        if (!$mail->Send()) {
43            echo "<br>".tra("failed to send email to %1: %2", $e, $mail->ErrorInfo)."\n";
44            continue;
45        }
46    } else {
47        if (!mail($e, $subject, $text, "From: $user->name <$user->email_addr>")) {
48            echo "<br>".tra("failed to send email to %1", $e)."\n";
49        }
50    }
51    echo "<br>".tra("email sent successfully to %1", $e)."\n";
52}
53if ($found) {
54    echo "
55        <p>".tra("Thanks for telling your friends about %1", PROJECT);
56} else {
57    echo tra("You forgot to enter email addresses; Please %1return to the form%2 and enter them.", "<a href=ffmail_form.php>", "</a>");
58}
59page_tail();
60
61?>
62