if (!Banana::$spool || Banana::$spool->group != $group) {
if ($group == @$_SESSION['banana_group'] && isset($_SESSION['banana_spool'])) {
Banana::$spool = unserialize($_SESSION['banana_spool']);
+ $clean = @(Banana::$profile['lastnews'] != $_SESSION['banana_lastnews']);
}
- BananaSpool::getSpool($group, Banana::$profile['lastnews'], Banana::$profile['autoup']);
+ BananaSpool::getSpool($group, Banana::$profile['lastnews'], Banana::$profile['autoup'] || $clean);
$_SESSION['banana_group'] = $group;
if (!Banana::$profile['display']) {
$_SESSION['banana_spool'] = serialize(Banana::$spool);
+ $_SESSION['banana_lastnews'] = Banana::$profile['lastnews'];
}
Banana::$spool->setMode(Banana::$profile['display'] ? Banana::SPOOL_UNREAD : Banana::SPOOL_ALL);
}
*/
public function send(BananaMessage &$message)
{
- return true;
+ $headers = $message->getHeaders();
+ $to = $headers['To'];
+ $subject = $headers['Subject'];
+ unset($headers['To']);
+ unset($headers['Subject']);
+ $hdrs = '';
+ foreach ($headers as $key=>$value) {
+ if (!empty($value)) {
+ $hdrs .= "$key: $value\r\n";
+ }
+ }
+ $body = $message->get(false);
+ return mail($to, $subject, $body, $hdrs);
}
/** Cancel a message
$content = "";
if ($with_headers) {
foreach ($this->getHeaders() as $key => $value) {
- $content .= "$key: $value\n";
- }
+ $line = "$key: $value";
+ $line = explode("\n", wordwrap($line, Banana::$msgshow_wrap));
+ for ($i = 1 ; $i < count($line) ; $i++) {
+ $line[$i] = "\t" . $line[$i];
+ }
+ $content .= implode("\n", $line) . "\n";
+ }
$content .= "\n";
}
if ($this->isType('multipart')) {
}
$content .= "\n--{$this->boundary}--";
} else {
- $content .= $this->body;
+ $content .= banana_wordwrap($this->body);
}
return $content;
}