-
Notifications
You must be signed in to change notification settings - Fork 31
Send the same email message to each recipient in a list
David-Apps edited this page Oct 3, 2021
·
12 revisions
This simple function sends the same message separately to each recipient whose email address appears in a list. The function expects 3 arguments:
- The number of the buffer containing the message that you want to send to each recipient. This message should include the "Subject" field. The function does not change this buffer.
- The number of the buffer containing the address list. Each line of the buffer contains an email address or an alias from your address book. The function deletes the lines of this buffer as it processes them. This makes it easier to continue processing the list after an error has occurred.
- The number of the buffer where the function should work. The function changes this buffer.
Suppose that:
-
Buffer 1 contains the message:
Subject: News update Not much has happened, but they say that no news is good news. Perhaps the next update will be more interesting.
-
Buffer 2 contains the address list:
-
Buffer 3 is empty.
Then, we can send the message to each recipient in the list with:
<sendlist 1 2 3
#Send a message separately to each email address in a list.
#usage: <sendlist <message buffer> <address list buffer> <working buffer>
#This function deletes the lines in the address list buffer as it processes them.
function+sendlist {
db0
e~2
1w~3
while(*) {
db1
d
db0
e~3
s/^/to: /
r~1
#Change the next line to send from a specific mail account.
<smf
#Uncomment and edit the next line if you want to wait between sending messages, perhaps because your mail provider limits the number of messages that you can send during a period.
#!sleep 60
bw
e~2
#Remove the next line if you do not want this progress indicator.
=
.w~3
}
}