unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: phillip.lord@newcastle.ac.uk (Phillip Lord)
To: Tassilo Horn <tsdh@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to get Gnus to send multiple emails
Date: Wed, 30 Apr 2014 16:42:20 +0100	[thread overview]
Message-ID: <87r44ej02r.fsf@newcastle.ac.uk> (raw)
In-Reply-To: <87mwf3rofh.fsf@gnu.org> (Tassilo Horn's message of "Wed, 30 Apr 2014 14:29:06 +0200")

Tassilo Horn <tsdh@gnu.org> 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




  reply	other threads:[~2014-04-30 15:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30  9:52 How to get Gnus to send multiple emails Phillip Lord
2014-04-30 10:27 ` Alberto Luaces
2014-04-30 10:38 ` Tassilo Horn
2014-04-30 11:26   ` Phillip Lord
2014-04-30 12:29     ` Tassilo Horn
2014-04-30 15:42       ` Phillip Lord [this message]
     [not found]       ` <mailman.389.1398873830.1147.help-gnu-emacs@gnu.org>
2014-04-30 18:47         ` .mailrc (was: How to get Gnus to send multiple emails) Emanuel Berg
2014-05-01  9:53           ` .mailrc Phillip Lord
     [not found]           ` <mailman.437.1398938006.1147.help-gnu-emacs@gnu.org>
2014-05-01 14:08             ` .mailrc Emanuel Berg
2014-05-01 14:45               ` .mailrc Phillip Lord
     [not found]               ` <mailman.442.1398955532.1147.help-gnu-emacs@gnu.org>
2014-05-02 23:50                 ` .mailrc Emanuel Berg

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=87r44ej02r.fsf@newcastle.ac.uk \
    --to=phillip.lord@newcastle.ac.uk \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tsdh@gnu.org \
    /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).