Tinderbox Forum

Creating mailing list from email addresses in different notes

I want to create a mailing list for a subset of individuals by extracting their email addresses from notes collected by an agent. There is a note for each individual concerned containing (among other things) the attribute “Email”. Could anyone suggest how this can be accomplished?

The details would of course vary with specifics of your system. But a simple overall approach to get started could be:

  • Have items with the relevant attributes you want, let’s say $RecipientName and $RecipientAddress.
  • Have another note whose purpose is to collect a list of the email addresses.
  • For that other, collector note, have a Rule that says something like:
    $Text=collect(children,$RecipientAddress).format("\n") [If the collector note is the parent container of the notes with the names and addresses] or
    $Text=collect(children(“AddressList”),$RecipientAddress).format("\n") [if the collector note is drawing addresses from some other set of notes, in this case notes within the “AddressList” container.

Formulas like this will give you a list of email addresses, separated by line breaks. Eg:
bgates@microsoft.com
mzuckerberg@facebook.com
etc

You can do this in more elaborate fashions, with lists containing other attribute values too – or via HTML export. Will let others lay out those details. But the collect operator will get you started. Details on collect are in aTbRef: “http://acrobatfaq.com/atbref7/index/ActionsRules/Operators/FullOperatorList/collectgroupattribute.html

If you have names in Apple Contacts, you can add those names to a Group, and then use that Group in Apple Mail to send the message.

To import names to Contracts you need a CSV file laid out similar to

Last Name,First Name,e-Mail Address
Kennedy,Joe,joe@example.com
Pea,Sweet,sweetpea@example.com

In Contacts you use File > Import, select the CSV, use the dialog that will appear to map your CSV to Contacts fields.

Then you need to make a group.

There is a thread in this forum that explains how to make a CSV file. No time to find it just now, but search will reveal it for you.

Fleshing out @JFallows’ answer a bit…

Email RFCs are a bit opaque to read but your list should comprise comma-delimited (comma, no spaces or line breaks) emails addresses in either of these forms:

  • jon@doe.com
  • Jane Doe<jane@doe.com>

Thus as a mailing a list this might look like: jon@doe.com,Jane Doe<jane@doe.com>

I’ll assume you are storing email addresses in $Email (e.g. jon@doe.com), and that the name to be used in the first part of the longer form above in $FullName (e.g. Jane Doe). I’ll assume all the notes with such data use the ‘Person’ prototype and that we’ve added a String type user attribute $EmailAddrString.

Now our agent uses this query:

$Prototype=="Person" (of course you can refine this query to find only people you want on the list)

The agent’s action is:

if($FullName){
   $EmailAddrString=$FullName+"<"+$Email+">";
}else{
   $EmailAddrString=$Email;
}

Lastly the agent’s rule is:

$Text=(collect(children,$EmailAddrString)).format(",");

The text of your note is now a correctly formatted string you can copy to your email ‘to’ field - or better the bcc field to keep recipients addresses hidden from each other. IOW , your agent $text will look like this:

jon@doe.com,Jane Doe<jane@doe.com>

Note: the use of a comma only between each address and no line breaks in the list as per the RFCs.

I realize that the initial response I gave was to the question I (on quick glance) thought you were asking (about developing a mailing list from a set of attributes you’d already assigned), rather than what you were actually asking, about extracting values. Thanks to @mwra and @PaulWalters for instructive answers to your actual question, which are informative for many of us.