From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.help Subject: Re: How to get Gnus to send multiple emails Date: Wed, 30 Apr 2014 16:42:20 +0100 Message-ID: <87r44ej02r.fsf@newcastle.ac.uk> References: <874n1bkuuq.fsf@newcastle.ac.uk> <87fvkvt84v.fsf@gnu.org> <8738gvjbxf.fsf@newcastle.ac.uk> <87mwf3rofh.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1398873851 11369 80.91.229.3 (30 Apr 2014 16:04:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Apr 2014 16:04:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 30 18:04:04 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WfWzI-000811-36 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Apr 2014 18:04:00 +0200 Original-Received: from localhost ([::1]:57756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfWzH-0004S8-MK for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Apr 2014 12:03:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfWz1-0004RY-8B for help-gnu-emacs@gnu.org; Wed, 30 Apr 2014 12:03:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WfWyl-000566-M9 for help-gnu-emacs@gnu.org; Wed, 30 Apr 2014 12:03:43 -0400 Original-Received: from cheviot12.ncl.ac.uk ([128.240.234.12]:37857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfWyl-00055t-GP; Wed, 30 Apr 2014 12:03:27 -0400 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129]) by cheviot12.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1WfWeK-0000NT-B3; Wed, 30 Apr 2014 16:42:20 +0100 Original-Received: from localhost (jangai.ncl.ac.uk [10.66.67.223]) (authenticated bits=0) by smtpauth-vm.ncl.ac.uk (8.13.8/8.13.8) with ESMTP id s3UFgKje007978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 30 Apr 2014 16:42:20 +0100 In-Reply-To: <87mwf3rofh.fsf@gnu.org> (Tassilo Horn's message of "Wed, 30 Apr 2014 14:29:06 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97483 Archived-At: Tassilo Horn writes: > The To: field isn't required. I've just sent a test mail with no To: > field and only > > Bcc: my@addr1.invalid, my@addr2.invalid > > and the mail was delivered correctly to both addresses. But of course, > there might be mailing lists that are configured to bounce messages > without To:. Yes, this is the case. >> I think that the email has to be sent independently several times with >> different To: fields. > > Ok, then this should do the trick: > > > (defun th/message-send-and-exit-multiple (addresses) > (interactive (list (split-string (read-string "Adresses: ") > "," t "[[:space:]]"))) > (while addresses > (let ((address (car addresses))) > (setq addresses (cdr addresses)) > (message-remove-header "To") > (message-add-header (format "To: %s" address)) > (if addresses > (message-send) > (message-send-and-exit))))) > Thank you, this is really helpful. I changed it in the end to this: (defun message-send-and-exit-multiple () (interactive) (let ((addresses (split-string (message-fetch-field "All") "," t))) (while addresses (let ((address (car addresses))) (setq addresses (cdr addresses)) (message-remove-header "To") (message-add-header (format "To: %s" address)) (if addresses (progn (message-send)) (message-send-and-exit)))))) It makes it a bit easier to interact with BBDB as the addresses are in the header. It asks about resending, which I was going to switch-off, but then I realised that this is probably a bad idea; quite easy to shoot myself in the foot with this function. Thanks again! Phil