It does not work because it cannot work this way: If you are sending mail, you are sending it to port 465 directly to Postfix - no Sieve script will be executed.
If you want to use the sieve language to work on outgoing mail, you would have to put in much more effort, because it is not nicely integrated into common software, at least nowhere near as nice as the Pigeonhole Sieve integration in Dovecot which will only trigger in two specific use cases:
- on receiving mail, a.k.a the final delivery stage of mail destined for a mailbox Dovecot manages, or
- on managing a mailbox, specifically actions of a local or IMAP-connected client on a mailbox Dovecot manages.
Notable, that integration will not handle the case of mail submission: While Dovecot does include a submission proxy, it is generally not involved at all in that direction, and in rare cases where this is used, then still not handling Sieve.
You got a few options now:
- trigger your script on the mail that is stored to a "sent" mailbox (but that would not act on mail that is not stored in that mailbox)
- replace your script with built-in functionality of Postfix. recipient_bcc_maps comes to mind
- configure postfix
header_checks
to simply reject mail that does not follow your policy (e.g. skips over the desired To: header, then reject all incomplete versions of it)
- configure the copy in some milter/filter
- configure an (preferably new, local) address which you setup to be expanded to the two addresses you want to receive the mail, let users send their mail there
- pipe mail for that recipient to a script, possibly one using your Sieve script (unlikely your best shot: using sieve outside of the LDA use case is simply not well supported by any existing software)