quelquecosa
quelquecosa

Reputation: 910

Linux mail command to bcc multiple addresses?

I am using linux mail command to send an automated email to a bunch of people once per week. I want each one of the recipients to be BCC'ed.

I am trying this command:

mail -v -s "Email Subject" -b [email protected], [email protected], [email protected], [email protected] -- -f [email protected] < /pathTo/dir/emailText.txt

But get this error:

You must specify direct recipients with -s, -c, or -b.

Upvotes: 1

Views: 7866

Answers (2)

poleguy
poleguy

Reputation: 585

It seems there are multiple versions of the mail command.

mail (GNU Mailutils) 3.7 has an append option to add headers and values directly without piping them in. Just add the headers you need there, e.g. bcc:

echo "Just testing my sendmail" | mail -s "Sendmail test" [email protected] --append=Bcc:[email protected],[email protected]

How to send mail through BCC in UNIX

Upvotes: 1

Barmar
Barmar

Reputation: 781741

you need to put them all in a single argument by quoting it.

mail -v -s "Email Subject" -b '[email protected], [email protected], [email protected], [email protected]' -- -f [email protected] < /pathTo/dir/emailText.txt

Upvotes: 2

Related Questions