Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2019 17:21:20 -0500
From:      Software Info <softwareinfojam@gmail.com>
To:        Miroslav Lachman <000.fbsd@quip.cz>,  "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>
Subject:   RE: Mailx Question
Message-ID:  <5cad1ae0.1c69fb81.b5b11.08ae@mx.google.com>
In-Reply-To: <0d44d441-3120-c140-40da-7a32baff0cae@quip.cz>
References:  <5cad0a1f.1c69fb81.c5304.4f33@mx.google.com> <0d44d441-3120-c140-40da-7a32baff0cae@quip.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
Fantastic. Works like a charm. Thank you very much.

Kind Regards
SI


Sent from Mail for Windows 10

From: Miroslav Lachman
Sent: Tuesday, April 9, 2019 4:40 PM
To: Software Info; freebsd-stable@freebsd.org
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 h=
ere. 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 wit=
h just a plain send using the command below.
> mailx -s "Test Emails" -b `cat mylist.txt` < body.txt -r "No-Reply<no-rep=
ly@email.com>"
>=20
> Of course, when I use a plain send, everybody sees everybody=E2=80=99s em=
ail address so I would love to be able to do a blind copy send. Would anyon=
e 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" ","`=20
my-generic@example.com < body.txt

Miroslav Lachman




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5cad1ae0.1c69fb81.b5b11.08ae>