Software Info wrote on 2019/04/09 23:09:> Hi All
> Since mailx is built into FreeBSD I decided to try asking this question
here. I have a text file with about 30 email addresses. The file will change
every day. I want an easy commandline way to read the file and blind copy send
an email to the addresses in the file. So far, I have this working with just a
plain send using the command below.
> mailx -s "Test Emails" -b `cat mylist.txt` < body.txt -r
"No-Reply<no-reply at email.com>"
>
> Of course, when I use a plain send, everybody sees everybody?s email
address so I would love to be able to do a blind copy send. Would anyone be able
to assist me with this?
It may depend on your MTA (Sendmail, Postfix, Exim etc.)
"You must specify direct recipients with -s, -c, or -b."
-b bcc-addr
Send blind carbon copies to bcc-addr list of users. The bcc-addr
argument should be a comma-separated list of names.
You should replace newlines with comma:
cat mylist.txt | tr "\n" ","
Maybe something like this will work for you:
mail -s "Test E-mails" -b `cat mylist.txt | tr "\n"
","`
my-generic at example.com < body.txt
Miroslav Lachman