how can I use BCC option in bash mail
by aristosv from LinuxQuestions.org on (#4XNA5)
I am using sendmail and gmail as a relay for outgoing emails on debian 10. This is the script I use for installing and configuring outgoing emails.
And then I use this in a bash script to send an email
Code:echo "email body" | mail -s "email subject" "myemail@goes.here"This works great.
I need to put the email address in the BCC field though. How can I do that?
I've seen suggestions for using the -b option, but when I do that I get a message saying mail: unrecognized option '-b'
I've also seen suggestions on using something like this
Code:echo -e "body" | mail -S smtp=localhost -s "Test subject 1" -b bccuser@gmail.com user@gmail.comBut then I get a message saying Code:mail: unrecognized option '-S'So how can I put the email address in the BCC field?
Thanks


And then I use this in a bash script to send an email
Code:echo "email body" | mail -s "email subject" "myemail@goes.here"This works great.
I need to put the email address in the BCC field though. How can I do that?
I've seen suggestions for using the -b option, but when I do that I get a message saying mail: unrecognized option '-b'
I've also seen suggestions on using something like this
Code:echo -e "body" | mail -S smtp=localhost -s "Test subject 1" -b bccuser@gmail.com user@gmail.comBut then I get a message saying Code:mail: unrecognized option '-S'So how can I put the email address in the BCC field?
Thanks