diff -Naur phpbb_orig/includes/functions_post.php phpbb/includes/functions_post.php
--- phpbb_orig/includes/functions_post.php	2006-06-09 16:29:41.000000000 +0200
+++ phpbb/includes/functions_post.php	2006-06-11 19:33:02.000000000 +0200
@@ -246,6 +246,66 @@
 	}

 	$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message',  bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
+
+	// Forum2Mail interface (first version by Enrico Tröger <enrico.troeger@uvena.de>)
+	if (strlen($post_subject) != 0)
+		$f2m_post_subject = $post_subject;
+	else
+	{
+		$db->sql_query("SELECT `topic_title` FROM ".TOPICS_TABLE." WHERE topic_id = ".$topic_id, FALSE);
+		$f2m_post_subject = $db->sql_fetchfield("topic_title");
+	}
+	$db->sql_query("SELECT `forum_name` FROM ".FORUMS_TABLE." WHERE forum_id = ".$forum_id, FALSE);
+	$f2m_forum_name = $db->sql_fetchfield("forum_name");
+	if ($attach_sig)
+	{
+		$f2m_signature = "\n\n-- \n".strip_bbcode($userdata['user_sig'], true);
+	}
+	else
+		$f2m_signature = "";
+	$f2m_footer = "\n\n-- \nThis mail was generated by Forum2Mail for http://www.debianforum.de";
+
+	$f2m_subject = "[".$f2m_forum_name."] ".$f2m_post_subject;
+	$f2m_text = strip_bbcode($post_message, $bbcode_on).$f2m_signature.$f2m_footer;
+	$f2m_headers  = "From: ".$post_username." <".$userdata['user_email'].">\n";
+	$f2m_headers .= "X-Mailer: Forum2Mail for debianforum.de\n";
+	if ($mode == 'editpost')
+	{	// if the post is edited, we increase the msgid by adding the edit count
+
+		// post_edit_count was already increased, we set the Reference to the last revision
+		$db->sql_query("SELECT `post_edit_count` FROM ".POSTS_TABLE." WHERE post_id = ".$post_id, FALSE);
+		$f2m_post_count = $db->sql_fetchfield("post_edit_count");
+
+		$f2m_headers .= "Message-Id: <".$post_id."-".$f2m_post_count."@debianforum.de>\n";
+
+		if ($f2m_post_count > 1)
+		{
+			$f2m_headers .= "References: <".$post_id."-".($f2m_post_count - 1)."@debianforum.de>\n";
+		}
+		else
+		{
+			$f2m_headers .= "References: <".$post_id."@debianforum.de>\n";
+		}
+	}
+	else
+	{
+		if ($mode == 'newtopic')
+		{	// don't set References if we start a new topic
+			$f2m_headers .= "Message-Id: <".$post_id."@debianforum.de>\n";
+		}
+		else
+		{
+			// get the id of the first post of this topic for use as reference
+			$db->sql_query("SELECT `topic_first_post_id` FROM ".TOPICS_TABLE." WHERE topic_id = ".$topic_id, FALSE);
+			$f2m_first_post_id = $db->sql_fetchfield("topic_first_post_id");
+
+			$f2m_headers .= "Message-Id: <".$post_id."@debianforum.de>\n";
+			$f2m_headers .= "References: <".$f2m_first_post_id."@debianforum.de>\n";
+		}
+	}
+	mail("enrico@localhost", $f2m_subject, $f2m_text, $f2m_headers);
+
+
 	if (!$db->sql_query($sql))
 	{
 		message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
@@ -329,6 +389,30 @@
 	return false;
 }

+function strip_bbcode($message, $bbcode_on)
+{
+	if($bbcode_on)
+	{
+		$message = preg_replace( "/\[b:(.*?)\](.*?)\[\/b:(.*?)\]/ims", "\\2", $message);
+		$message = preg_replace( "/\[i:(.*?)\](.*?)\[\/i:(.*?)\]/ims", "\\2", $message);
+/*		other tags to process
+		[list]
+		[color]
+		[quote]
+		[quote_username]
+		[code]
+		[img]
+		[url1]
+		[url2]
+		[url3]
+		[url4]
+		[email]
+*/
+	}
+	return $message;
+}
+
+
 //
 // Update post stats and details
 //

