From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Q: prevent Emacs from sending mail with no subject Date: Tue, 23 Dec 2003 11:51:28 -0700 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3FE88EB0.7020502@yahoo.com> References: <227a55e9.0312230844.1882eac0@posting.google.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1072206033 23876 80.91.224.253 (23 Dec 2003 19:00:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Dec 2003 19:00:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 23 20:00:29 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AYrlc-0006YA-00 for ; Tue, 23 Dec 2003 20:00:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AYsiW-0007Fg-27 for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Dec 2003 15:01:20 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: news.uni-berlin.de 1072205489 11756350 170.207.51.80 ([82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:119606 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15546 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15546 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