- tmpfil="${tmpdir}/mhmail$$"
- tmpfilbackup="${tmpdir}/[,#]mhmail$$"
- trap 'rm -f '"${tmpfil}"' '"${tmpfilbackup}" EXIT
+ tmpfile="${tmpdir}/mhmail$$"
+ tmpfilebackup="${tmpdir}/[,#]mhmail$$"
+ tmpfileresent=
+
+ message_file=
+ if [ ${resent} -eq 0 ]; then
+ #### Add blank line after header if not resending.
+ header="${header}
+"
+ message_file="${tmpfile}"
+ else
+ if [ ${use_send} -eq 0 ]; then
+ postsendargs="${postsendargs:+${postsendargs} }-dist"
+ message_file="${tmpfile}"
+ else
+ #### When resending with send, tmpfile will just contain the
+ #### Resent- header fields. "${tmpfileresent}" will contain
+ #### the message that is being resent.
+ tmpfileresent="${tmpdir}/mhmail-resent$$"
+ mhdist=1; export mhdist
+ mhaltmsg=${tmpfileresent}; export mhaltmsg
+ message_file="${tmpfileresent}"
+ printf "" >"${message_file}" || exit 2
+ fi
+ fi
+
+ trap 'rm -f '"${tmpfile}"' '"${tmpfilebackup}"' '"${tmpfileresent}" EXIT