diff -ur postfix-2.1.4.orig/src/global/mail_params.h postfix-2.1.4/src/global/mail_params.h
--- postfix-2.1.4.orig/src/global/mail_params.h	2004-09-07 00:40:56.000000000 +0900
+++ postfix-2.1.4/src/global/mail_params.h	2004-09-06 16:48:22.000000000 +0900
@@ -901,6 +901,27 @@
 #define DEF_SMTPD_NOOP_CMDS	""
 extern char *var_smtpd_noop_cmds;
 
+#define VAR_SMTPD_RCVD_FORMAT	"smtpd_received_header_format"
+#define DEF_SMTPD_RCVD_FORMAT	"$received_from$lf$tab$received_by $received_with $received_id$lf$tab$received_for"
+
+#define VAR_SMTPD_RCVD_NAME	"smtpd_received_header_name"
+#define DEF_SMTPD_RCVD_NAME	"Received"
+
+#define VAR_SMTPD_RCVD_FROM	"smtpd_received_from"
+#define DEF_SMTPD_RCVD_FROM	"from $helo_name ($name [$addr])"
+
+#define VAR_SMTPD_RCVD_BY	"smtpd_received_by"
+#define DEF_SMTPD_RCVD_BY	"by $myhostname"
+
+#define VAR_SMTPD_RCVD_WITH	"smtpd_received_with"
+#define DEF_SMTPD_RCVD_WITH	"with $protocol"
+
+#define VAR_SMTPD_RCVD_ID	"smtpd_received_id"
+#define DEF_SMTPD_RCVD_ID	"id $queue_id"
+
+#define VAR_SMTPD_RCVD_FOR	"smtpd_received_for"
+#define DEF_SMTPD_RCVD_FOR	"for <$recipient>"
+
  /*
   * SASL authentication support, SMTP server side.
   */
diff -ur postfix-2.1.4.orig/src/smtpd/smtpd.c postfix-2.1.4/src/smtpd/smtpd.c
--- postfix-2.1.4.orig/src/smtpd/smtpd.c	2004-09-07 00:40:56.000000000 +0900
+++ postfix-2.1.4/src/smtpd/smtpd.c	2004-09-07 01:00:23.000000000 +0900
@@ -652,6 +652,7 @@
 #include <anvil_clnt.h>
 #endif
 #include <flush_clnt.h>
+#include <mac_parse.h>
 
 /* Single-threaded server skeleton. */
 
@@ -754,6 +755,13 @@
 char   *var_xforward_hosts;
 bool    var_smtpd_rej_unl_from;
 bool    var_smtpd_rej_unl_rcpt;
+char   *var_smtpd_rcvd_format;
+char   *var_smtpd_rcvd_name;
+char   *var_smtpd_rcvd_from;
+char   *var_smtpd_rcvd_by;
+char   *var_smtpd_rcvd_with;
+char   *var_smtpd_rcvd_id;
+char   *var_smtpd_rcvd_for;
 
 #ifdef SNAPSHOT
 int     var_smtpd_crate_limit;
@@ -1505,6 +1513,103 @@
     state->rcpt_overshoot = 0;
 }
 
+typedef struct {
+    SMTPD_STATE *state;
+    VSTRING *buffer;
+} SMTPD_RCVD_PARSE_ARG;
+
+static rcvd_parse_callback2(int type, VSTRING *buf, char *context)
+{
+    SMTPD_RCVD_PARSE_ARG *arg = (SMTPD_RCVD_PARSE_ARG *)context;
+    char *s = STR(buf);
+    if (type == MAC_PARSE_LITERAL)
+	vstring_strcat(arg->buffer, s);
+    else if (type == MAC_PARSE_VARNAME) {
+	SMTPD_STATE *state = arg->state;
+	if (strcmp(s, "tab") == 0)
+	    vstring_strcat(arg->buffer, "\t");
+	else if (strcmp(s, "lf") == 0)
+	    vstring_strcat(arg->buffer, "\n");
+	else if (strcmp(s, "helo_name") == 0)
+	    vstring_strcat(arg->buffer, state->helo_name ? state->helo_name : state->name);
+	else if (strcmp(s, "name") == 0)
+	    vstring_strcat(arg->buffer, state->name);
+	else if (strcmp(s, "addr") == 0)
+	    vstring_strcat(arg->buffer, state->addr);
+	else if (strcmp(s, "myhostname") == 0)
+	    vstring_strcat(arg->buffer, var_myhostname);
+	else if (strcmp(s, "mail_name") == 0)
+	    vstring_strcat(arg->buffer, var_mail_name);
+	else if (strcmp(s, "protocol") == 0)
+	    vstring_strcat(arg->buffer, state->protocol);
+	else if (strcmp(s, "queue_id") == 0)
+	    vstring_strcat(arg->buffer, state->queue_id);
+	else if (strcmp(s, "time") == 0)
+	    vstring_strcat(arg->buffer, mail_date(state->time));
+	else if (strcmp(s, "sender") == 0) {
+	    quote_822_local(state->buffer, state->sender);
+	    vstring_strcat(arg->buffer, STR(state->buffer));
+	} else if (strcmp(s, "recipient") == 0) {
+	    quote_822_local(state->buffer, state->recipient);
+	    vstring_strcat(arg->buffer, STR(state->buffer));
+	} else
+	    msg_warn("smtpd_received_header_format: %s: unknown parameter", s);
+    }
+    return 0;
+}
+
+static rcvd_parse_callback(int type, VSTRING *buf, char *context)
+{
+    SMTPD_RCVD_PARSE_ARG *arg = (SMTPD_RCVD_PARSE_ARG *)context;
+    char *s = STR(buf);
+    if (type == MAC_PARSE_LITERAL)
+	vstring_strcat(arg->buffer, s);
+    else if (type == MAC_PARSE_VARNAME) {
+	SMTPD_STATE *state = arg->state;
+	if (strcmp(s, "received_from") == 0)
+	    mac_parse(var_smtpd_rcvd_from, rcvd_parse_callback2, (char *)arg);
+	else if (strcmp(s, "received_by") == 0)
+	    mac_parse(var_smtpd_rcvd_by, rcvd_parse_callback2, (char *)arg);
+	else if (strcmp(s, "received_with") == 0)
+	    mac_parse(var_smtpd_rcvd_with, rcvd_parse_callback2, (char *)arg);
+	else if (strcmp(s, "received_id") == 0) {
+	    if (state->cleanup)
+		mac_parse(var_smtpd_rcvd_id, rcvd_parse_callback2, (char *)arg);
+	} else if (strcmp(s, "received_for") == 0) {
+	    if (state->rcpt_count == 1 && state->recipient)
+		mac_parse(var_smtpd_rcvd_for, rcvd_parse_callback2, (char *)arg);
+	} else if (strcmp(s, "tab") == 0)
+	    vstring_strcat(arg->buffer, "\t");
+	else if (strcmp(s, "lf") == 0)
+	    vstring_strcat(arg->buffer, "\n");
+	else if (strcmp(s, "helo_name") == 0)
+	    vstring_strcat(arg->buffer, state->helo_name ? state->helo_name : state->name);
+	else if (strcmp(s, "name") == 0)
+	    vstring_strcat(arg->buffer, state->name);
+	else if (strcmp(s, "addr") == 0)
+	    vstring_strcat(arg->buffer, state->addr);
+	else if (strcmp(s, "myhostname") == 0)
+	    vstring_strcat(arg->buffer, var_myhostname);
+	else if (strcmp(s, "mail_name") == 0)
+	    vstring_strcat(arg->buffer, var_mail_name);
+	else if (strcmp(s, "protocol") == 0)
+	    vstring_strcat(arg->buffer, state->protocol);
+	else if (strcmp(s, "queue_id") == 0)
+	    vstring_strcat(arg->buffer, state->queue_id);
+	else if (strcmp(s, "time") == 0)
+	    vstring_strcat(arg->buffer, mail_date(state->time));
+	else if (strcmp(s, "sender") == 0 && state->sender) {
+	    quote_822_local(state->buffer, state->sender);
+	    vstring_strcat(arg->buffer, STR(state->buffer));
+	} else if (strcmp(s, "recipient") == 0 && state->recipient) {
+	    quote_822_local(state->buffer, state->recipient);
+	    vstring_strcat(arg->buffer, STR(state->buffer));
+	} else
+	    msg_warn("smtpd_received_header_format: %s: unknown parameter", s);
+    }
+    return 0;
+}
+
 /* data_cmd - process DATA command */
 
 static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
@@ -1600,6 +1705,27 @@
      * intermediate proxy.
      */
     if (!state->proxy || state->xforward.flags == 0) {
+	if (var_smtpd_rcvd_name && *var_smtpd_rcvd_name) {
+	    SMTPD_RCVD_PARSE_ARG arg;
+	    int len;
+	    arg.state = state;
+	    arg.buffer = vstring_alloc(128);
+	    vstring_strcpy(arg.buffer, "");
+	    mac_parse(var_smtpd_rcvd_format, rcvd_parse_callback, (char *)&arg);
+	    for (len = LEN(arg.buffer)-1; len >= 0; len--)
+		if (! isspace(STR(arg.buffer)[len]))
+		    break;
+	    len++;
+	    vstring_truncate(arg.buffer, len);
+	    VSTRING_TERMINATE(arg.buffer);
+	    out_fprintf(out_stream, REC_TYPE_NORM,
+			"%s: %s;\n\t%s", var_smtpd_rcvd_name, STR(arg.buffer),
+			mail_date(state->time));
+	    vstring_free(arg.buffer);
+	}
+    }
+#if 0
+    if (!state->proxy || state->xforward.flags == 0) {
 	out_fprintf(out_stream, REC_TYPE_NORM,
 		    "Received: from %s (%s [%s])",
 		    state->helo_name ? state->helo_name : state->name,
@@ -1628,6 +1754,7 @@
 		    "\t(envelope-from %s)", STR(state->buffer));
 #endif
     }
+#endif
     smtpd_chat_reply(state, "354 End data with <CR><LF>.<CR><LF>");
 
     /*
@@ -2775,11 +2902,18 @@
 #ifdef SNAPSHOT
 	VAR_SMTPD_HOGGERS, DEF_SMTPD_HOGGERS, &var_smtpd_hoggers, 0, 0,
 #endif
+	VAR_SMTPD_RCVD_NAME, DEF_SMTPD_RCVD_NAME, &var_smtpd_rcvd_name, 0, 0,
 	0,
     };
     static CONFIG_RAW_TABLE raw_table[] = {
 	VAR_SMTPD_EXP_FILTER, DEF_SMTPD_EXP_FILTER, &var_smtpd_exp_filter, 1, 0,
 	VAR_DEF_RBL_REPLY, DEF_DEF_RBL_REPLY, &var_def_rbl_reply, 1, 0,
+	VAR_SMTPD_RCVD_FORMAT, DEF_SMTPD_RCVD_FORMAT, &var_smtpd_rcvd_format, 0, 0,
+	VAR_SMTPD_RCVD_FROM, DEF_SMTPD_RCVD_FROM, &var_smtpd_rcvd_from, 0, 0,
+	VAR_SMTPD_RCVD_BY, DEF_SMTPD_RCVD_BY, &var_smtpd_rcvd_by, 0, 0,
+	VAR_SMTPD_RCVD_WITH, DEF_SMTPD_RCVD_WITH, &var_smtpd_rcvd_with, 0, 0,
+	VAR_SMTPD_RCVD_ID, DEF_SMTPD_RCVD_ID, &var_smtpd_rcvd_id, 0, 0,
+	VAR_SMTPD_RCVD_FOR, DEF_SMTPD_RCVD_FOR, &var_smtpd_rcvd_for, 0, 0,
 	0,
     };
 
