/*
- * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
+ * Copyright (C) 1999-2004 Thomas Roessler <roessler@does-not-exist.org>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
-#include "rfc1524.h"
-#include "mime.h"
-#include "mailbox.h"
#include "attach.h"
#include "mapping.h"
-#include "mx.h"
#include "copy.h"
#include "mutt_idna.h"
/* one or more messages? */
p = (cur || count_tagged (idx, idxlen) == 1);
+ /* RfC 5322 mandates a From: header, so warn before bouncing
+ * messages without one */
+ if (cur)
+ {
+ if (!cur->hdr->env->from)
+ {
+ mutt_error _("Warning: message contains no From: header");
+ mutt_sleep (2);
+ mutt_clear_error ();
+ }
+ }
+ else
+ {
+ for (i = 0; i < idxlen; i++)
+ {
+ if (idx[i]->content->tagged)
+ {
+ if (!idx[i]->content->hdr->env->from)
+ {
+ mutt_error _("Warning: message contains no From: header");
+ mutt_sleep (2);
+ mutt_clear_error ();
+ break;
+ }
+ }
+ }
+ }
+
if (p)
strfcpy (prompt, _("Bounce message to: "), sizeof (prompt));
else
}
if (mime_fwd_any &&
- (last = copy_problematic_attachments (fp, last, idx, idxlen, mime_fwd_all)) == NULL)
+ copy_problematic_attachments (fp, last, idx, idxlen, mime_fwd_all) == NULL)
goto bail;
}
mutt_forward_trailer (tmpfp);
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
tmpfp = NULL;
/* now that we have the template, send it. */
if (tmpfp)
{
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
mutt_unlink (tmpbody);
}
}
}
}
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
}
else if (rc == M_YES) /* do MIME encapsulation - we don't need to do much here */
{
copy_problematic_attachments (fp, &tmphdr->content, idx, idxlen, 0) == NULL)
{
mutt_free_header (&tmphdr);
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
return;
}
}
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
if (ci_send_message (flags, tmphdr, tmpbody, NULL, parent) == 0)
mutt_set_flag (Context, hdr, M_REPLIED, 1);