structures.
All thnx goes to Aaron van Meerten for identifying the bug and all the
testwork.
Modified rfc822 headers to avoid getting hit by spamassassin rules.
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5995
7612ce4b-ef26-0410-bec9-
ea0150e637f0
}
function writeBody($message, $stream, &$length_raw, $boundary='') {
}
function writeBody($message, $stream, &$length_raw, $boundary='') {
+ // calculate boundary in case of multidimensional mime structures
+ if ($boundary && $message->entity_id && count($message->entities)) {
+ if (strpos($boundary,'_part_')) {
+ $boundary = substr($boundary,0,strpos($boundary,'_part_'));
+ }
+ $boundary_new = $boundary . '_part_'.$message->entity_id;
+ } else {
+ $boundary_new = $boundary;
+ }
if ($boundary && !$message->rfc822_header) {
$s = '--'.$boundary."\r\n";
if ($boundary && !$message->rfc822_header) {
$s = '--'.$boundary."\r\n";
- $s .= $this->prepareMIME_Header($message, $boundary);
+ $s .= $this->prepareMIME_Header($message, $boundary_new);
$length_raw += strlen($s);
if ($stream) {
$this->preWriteToStream($s);
$length_raw += strlen($s);
if ($stream) {
$this->preWriteToStream($s);
}
}
$this->writeBodyPart($message, $stream, $length_raw);
}
}
$this->writeBodyPart($message, $stream, $length_raw);
- $boundary_depth = substr_count($message->entity_id,'.');
- if ($boundary_depth) {
- $boundary .= '_part'.$boundary_depth;
- }
$last = false;
for ($i=0, $entCount=count($message->entities);$i<$entCount;$i++) {
$last = false;
for ($i=0, $entCount=count($message->entities);$i<$entCount;$i++) {
- $msg = $this->writeBody($message->entities[$i], $stream, $length_raw, $boundary);
+ $msg = $this->writeBody($message->entities[$i], $stream, $length_raw, $boundary_new);
if ($i == $entCount-1) $last = true;
}
if ($boundary && $last) {
if ($i == $entCount-1) $last = true;
}
if ($boundary && $last) {
$date = date('D, j M Y H:i:s ', mktime()) . $this->timezone();
/* Create a message-id */
$message_id = '<' . $REMOTE_PORT . '.' . $REMOTE_ADDR . '.';
$date = date('D, j M Y H:i:s ', mktime()) . $this->timezone();
/* Create a message-id */
$message_id = '<' . $REMOTE_PORT . '.' . $REMOTE_ADDR . '.';
- $message_id .= time() . '.squirrel@' . $SERVER_NAME .'>';
+ $message_id .= time() . '.squirrel@' . $REMOTE_ADDR .'>';
/* Make an RFC822 Received: line */
if (isset($REMOTE_HOST)) {
$received_from = "$REMOTE_HOST ([$REMOTE_ADDR])";
/* Make an RFC822 Received: line */
if (isset($REMOTE_HOST)) {
$received_from = "$REMOTE_HOST ([$REMOTE_ADDR])";
}
$header = array();
$header[] = "Received: from $received_from" . $rn;
}
$header = array();
$header[] = "Received: from $received_from" . $rn;
- $header[] = " (SquirrelMail authenticated user $username)" . $rn;
+ $header[] = " (SquirrelMail authenticated user $username);" . $rn;
$header[] = " by $SERVER_NAME with HTTP;" . $rn;
$header[] = " $date" . $rn;
/* Insert the rest of the header fields */
$header[] = " by $SERVER_NAME with HTTP;" . $rn;
$header[] = " $date" . $rn;
/* Insert the rest of the header fields */
}
}
/* Identify SquirrelMail */
}
}
/* Identify SquirrelMail */
- $header[] = 'User-Agent: SquirrelMail/' . $version . $rn;
+ $header[] = 'User-Agent: SquirrelMail/' . $version . $rn;
+ // Spamassassin complains about no X-Mailer in combination with X-Priority
+ $header[] = 'X-Mailer: SquirrelMail/' . $version . $rn;
/* Do the MIME-stuff */
$header[] = 'MIME-Version: 1.0' . $rn;
$contenttype = 'Content-Type: '. $rfc822_header->content_type->type0 .'/'.
/* Do the MIME-stuff */
$header[] = 'MIME-Version: 1.0' . $rn;
$contenttype = 'Content-Type: '. $rfc822_header->content_type->type0 .'/'.
}
if ($rfc822_header->priority) {
$prio = $rfc822_header->priority;
}
if ($rfc822_header->priority) {
$prio = $rfc822_header->priority;
- $header[] = 'X-Priority: '.$prio. $rn;
+ $header[] = 'X-Priority: '. $prio. $rn;
switch($prio)
{
case 1: $header[] = 'Importance: High'. $rn; break;
switch($prio)
{
case 1: $header[] = 'Importance: High'. $rn; break;