Mailx Question

Software Info softwareinfojam at
Tue Apr 9 22:21:22 UTC 2019

Fantastic. Works like a charm. Thank you very much.

Kind Regards

Sent from Mail for Windows 10

From: Miroslav Lachman
Sent: Tuesday, April 9, 2019 4:40 PM
To: Software Info; freebsd-stable at
Subject: Re: Mailx Question

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>"
> 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 < body.txt

Miroslav Lachman

More information about the freebsd-stable mailing list