nmh-workers
[Top] [All Lists]

Re: One-liner to retrieve an email's recipients?

2020-08-19 03:25:25
Hi Conrad,

I cottoned on to using

  %(formataddr {to})%(formataddr {cc})%(putstr)

as a merge trick, but there's no way of applying %(addr) to a list,
right?  So your nice grep regexp there looks like it'd be one of the
best ways of extracting the pure addresses after all..?

Ken's explained that side of things.  I did have another idea.

    $ cat 2
    from: me@here.example.com
    to: Foo Bar <foo@bar.example.com>, xyzzy@example.com
    cc: Xyzzy <xyzzy2@example.com>
    resent-to: postmaster@example.com
    resent-cc: abuse@example.com
    $
    $ whom 2
    whom: illegal header line -- resent-to:
    whom: illegal header line -- resent-cc:
    whom: re-format message and try again
    $
    $ sed -i 's/^resent-//' 2
    $ whom 2
      -- Network Recipients --
      foo at bar.example.com
      xyzzy at example.com
      xyzzy2 at example.com
      postmaster at example.com
      abuse at example.com
    $

-- 
Cheers, Ralph.

<Prev in Thread] Current Thread [Next in Thread>