- ** Scan the draft file for an attachment header field name.
- */
- length = strlen(attach_hdr);
- has_attachment = 0;
- while (get_line() != EOF && *field != '\0' && *field != '-') {
- if (strncasecmp(field, attach_hdr, length)==0 &&
- field[length] == ':') {
- has_attachment = 1;
- }
- }
-
- /*
- ** Look for at least one non-blank line in the body of the
- ** message which indicates content in the body.
- ** Check if body contains at least one non-blank (= not empty)
- ** and if it contains any non-ASCII chars (= need MIME).
- */
- has_body = 0;
- non_ascii = 0;
- while (get_line() != EOF) {
- for (p = field; *p != '\0'; p++) {
- if (*p != ' ' && *p != '\t') {
- has_body = 1;
- }
- if (*p > 127 || *p < 0) {
- non_ascii = 1;
- }
- }
- if (has_body && non_ascii) {
- break; /* that's been already enough information */
- }
- }
-
- if (!has_attachment && non_ascii==0) {
- /* We don't need to convert it to MIME. */
- return DONE;
- }
-
- /*
- ** Else: mimify