help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get Gnus to send multiple emails


From: Phillip Lord
Subject: Re: How to get Gnus to send multiple emails
Date: Wed, 30 Apr 2014 16:42:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]