+
+ /* for sendmail/pipe, insert all bcc recipients here so that the email can be routed based on the bcc: header */
+ if (sm_mts == MTS_SENDMAIL_PIPE)
+ {
+ char *allbcc = NULL;
+ struct mailname *lp;
+
+ for (lp = localaddrs.m_next; lp; lp = lp->m_next)
+ if (lp->m_bcc)
+ allbcc = allbcc? add(concat(", ", lp->m_mbox, NULL), allbcc)
+ : mh_xstrdup(lp->m_mbox);
+ for (lp = netaddrs.m_next; lp; lp = lp->m_next)
+ if (lp->m_bcc)
+ allbcc = allbcc? add(
+ concat(", ", lp->m_mbox, "@", lp->m_host, NULL),
+ allbcc)
+ : concat(lp->m_mbox, "@", lp->m_host, NULL);
+ if (allbcc)
+ {
+ fprintf (out, "BCC: %s\n",allbcc);
+ free(allbcc);
+ }
+ }
+ else
+ {
+ fprintf (out, "BCC:\n");
+ }