From: Rocco Rutte Date: Fri, 12 Jun 2009 11:43:01 +0000 (+0200) Subject: Warn before bouncing messages without From: header. Closes #3180. X-Git-Tag: neomutt-20160307~584^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70d16d16b201281fc57cdea3d53bfce9984766db;p=neomutt Warn before bouncing messages without From: header. Closes #3180. --- diff --git a/ChangeLog b/ChangeLog index 4453038d6..cc9cbfc02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-06-11 18:34 +0200 Rocco Rutte (f60eb41ef63c) + + * UPDATING: Mention maildir mtime use in browser + +2009-06-11 18:31 +0200 Rocco Rutte (fc60d44a5b22) + + * ChangeLog, send.c: Don't allow setting Return-Path: header via + my_hdr + + Mutt has use_envelope_from/envelope_from_address for that purpose. + Closes #1840. + 2009-06-11 18:17 +0200 Rocco Rutte (8efc1cd0b8c0) * browser.c: Use only latest mtime of new/cur for browser, not whole diff --git a/commands.c b/commands.c index 9aa505e7c..b9febd1dc 100644 --- a/commands.c +++ b/commands.c @@ -246,6 +246,29 @@ void ci_bounce_message (HEADER *h, int *redraw) char *err = NULL; int rc; + /* RfC 5322 mandates a From: header, so warn before bouncing + * messages without one */ + if (h) + { + if (!h->env->from) + { + mutt_error _("Warning: message has no From: header"); + mutt_sleep (2); + } + } + else if (Context) + { + for (rc = 0; rc < Context->msgcount; rc++) + { + if (Context->hdrs[rc]->tagged && !Context->hdrs[rc]->env->from) + { + mutt_error ("Warning: message has no From: header"); + mutt_sleep (2); + break; + } + } + } + if(h) strfcpy(prompt, _("Bounce message to: "), sizeof(prompt)); else diff --git a/recvcmd.c b/recvcmd.c index 2a8f7df39..5f4511f6b 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -139,6 +139,34 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, /* 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