+ log_write(0, LOG_MAIN|LOG_PANIC, "%s", string_open_failed(errno,
+ "scan file %s", mbox_path));
+ goto OUT;
+ };
+
+ /* Generate mailbox headers. The $received_for variable is (up to at least
+ Exim 4.64) never set here, because it is only set when expanding the
+ contents of the Received: header line. However, the code below will use it
+ if it should become available in future. */
+
+ temp_string = expand_string(
+ US"From ${if def:return_path{$return_path}{MAILER-DAEMON}} ${tod_bsdinbox}\n"
+ "${if def:sender_address{X-Envelope-From: <${sender_address}>\n}}"
+ "${if def:recipients{X-Envelope-To: ${recipients}\n}}");
+
+ if (temp_string != NULL) {
+ i = fwrite(temp_string, Ustrlen(temp_string), 1, mbox_file);
+ if (i != 1) {
+ log_write(0, LOG_MAIN|LOG_PANIC, "Error/short write while writing \
+ mailbox headers to %s", mbox_path);
+ goto OUT;
+ };