summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-04-13 19:58:06 +0000
committeruckelman <uckelman@nomic.net>2010-04-13 19:58:06 +0000
commitad5cfb788fd4a9266c666cdb14fc5d10a0f77947 (patch)
tree634ef7a05df9300b0b2166d35fe966f80ff886b7 /src
parent14934552b8ee0122dc2272a2d08b5c571c67eeec (diff)
Added mail code.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6698 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r--src/F2M.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/F2M.php b/src/F2M.php
index e4cd479..df988d3 100644
--- a/src/F2M.php
+++ b/src/F2M.php
@@ -9,18 +9,23 @@ catch (Exception $e) {
function send_to_lists($user, $data, $post_data) {
- require_once(__DIR__ . '/PhpBB3.php');
- require_once(__DIR__ . '/Util.php');
-
- $phpbb = new PhpBB3();
-
-/*
require_once('Mail.php');
require_once(__DIR__ . '/Bridge.php');
-*/
+ require_once(__DIR__ . '/PhpBB3.php');
+ require_once(__DIR__ . '/Util.php');
$postId = $data['post_id'];
+ $forumId = $data['forum_id'];
+
+ $bridge = new Bridge();
+
+ $to = $bridge->getLists($forumId);
+ if (count($to) == 0) {
+ # No lists to send to, bail out.
+ return;
+ }
+ $to = implode(', ', $to);
$userName = $user->data['username'];
$userEmail = $user->data['user_email'];
@@ -29,6 +34,8 @@ function send_to_lists($user, $data, $post_data) {
$sender = 'forum@test.nomic.net';
$subject = utf8_quote($post_data['post_subject']);
+ $phpbb = new PhpBB3();
+
$time = $phpbb->getPostTime($postId);
if ($time === false) {
throw new Exception('no post time: ' . $postId);
@@ -42,30 +49,29 @@ function send_to_lists($user, $data, $post_data) {
$body = $data['message'];
+/*
print '<p>';
var_dump($data);
var_dump($post_data);
print '</p>';
+*/
-/*
- $bridge = new Bridge();
-
- $to = $bridge->getLists($forumId);
- if ($to == false) {
-
+ # assemble the message headers
$headers = array(
- 'To' => implode(', ', $to),
- 'From' => "$userName <$userEmail>",
+ 'To' => $to,
+ 'From' => $from,
'Subject' => $subject,
'Date', => $date,
'Message-Id', => $messageId,
'X-BeenThere' => $forumURL,
);
+ # send the message
$mailer = Mail::factory('sendmail');
- $mailer->send($to, $headers, $body);
-*/
-
+ $err = $mailer->send($to, $headers, $body);
+ if (PEAR::isError($err)) {
+ throw new Exception('Mail::send error: ' . $err->toString());
+ }
}
?>