+ char *original_draft; /* name of original draft file */
+ char *p; /* string pointer for building file name */
+ char composition_file_name[PATH_MAX + 1]; /* name of mhbuild composition temporary file */
+ char body_file_name[PATH_MAX + 1]; /* name of temporary file for body content */
+
+ /*
+ * Save the original name of the draft file. The name of the draft file is changed
+ * to a temporary file containing the built MIME message if there are attachments.
+ * We need the original name so that it can be renamed after the message is sent.
+ */
+
+ original_draft = drft;
+
+ /*
+ * There might be attachments if a header field name for attachments is supplied.
+ * Convert the draft to a MIME message. Use the mhbuild composition file for the
+ * draft if there was a successful conversion because that now contains the MIME
+ * message. A nice side effect of this is that it leaves the original draft file
+ * untouched so that it can be retrieved and modified if desired.
+ */
+
+ if (attachment_header_field_name != (char *)0) {
+ switch (attach(attachment_header_field_name, drft,
+ body_file_name, sizeof body_file_name,
+ composition_file_name, sizeof composition_file_name,
+ attachformat)) {
+ case OK:
+ drft = composition_file_name;
+ break;
+
+ case NOTOK:
+ return (NOTOK);
+
+ case DONE:
+ break;
+ }
+ }