unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Q: prevent Emacs from sending mail with no subject
Date: Tue, 23 Dec 2003 11:51:28 -0700	[thread overview]
Message-ID: <3FE88EB0.7020502@yahoo.com> (raw)
In-Reply-To: 227a55e9.0312230844.1882eac0@posting.google.com

Eric Pement wrote:

> I would like to know how to prevent Emacs from sending email with no
> subject (or with a subject line that contains only whitespace). I've
> accidentally sent a couple of messages this way, and I think Emacs
> converted the subject line to "(unknown)" for me, but I'm not sure. At
> any rate, I want Emacs to not send the message if the subject line is
> empty, but to prompt me to enter the missing subject.
> 
> I've already checked the FAQ, the Customization menu, "Learning GNU
> Emacs" and searched the Google archives for this issue, but I can't
> seem to find the answer. Any help would be appreciated.

Emacs is not changing your Subject header (I just checked the lisp/mail/*.el
files distributed with Emacs 21.3).  It is probably your site's MTA -- are
you using sendmail.el or smtpmail.el, or something else?

In any case, you probably want to add the check for an empty Subject header
to mail-send-hook:

(defun mail-send-check-subject ()
   (save-excursion
     ;; see mail-position-on-field:
     (goto-char (point-min))
     (let ((case-fold-search t))
       (if (re-search-forward "^Subject:[ \t]*" (mail-header-end))
           ;; else signal an error
           (if (eolp)
               (insert (read-string "Subject: ")))))))

(add-hook 'mail-send-hook 'mail-send-check-subject)

-- 
Kevin Rodgers

      parent reply	other threads:[~2003-12-23 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-23 16:44 Q: prevent Emacs from sending mail with no subject Eric Pement
2003-12-23 17:26 ` Kin Cho
2003-12-23 18:51 ` Kevin Rodgers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FE88EB0.7020502@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).