BCC mail in script ?

BCC mail in script ?

Post by dh » Fri, 22 Mar 2002 04:12:52



Hi group -

I'm trying to run a script that sends out mail to a receiver list, but I'd
like to send to all recipients as bcc. The receiver list is all on one line,
separated by space. (I've also tried commas)

I've looked thru google and man pages and don';t see what I'm doing wrong as
the man page states
"mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr..."

Here's the script. It *works* but it does not bcc.

#! /usr/local/bin/perl

$reclist = `/bin/cat contact_email.file`;
$thedate=`/bin/date`;

`echo "This email notification is being sent to you because you asked for
it" | mail -s "Your Update" -b $reclist`;

 
 
 

BCC mail in script ?

Post by Davi » Fri, 22 Mar 2002 07:47:35



> Hi group -

> I'm trying to run a script that sends out mail to a receiver list, but I'd
> like to send to all recipients as bcc. The receiver list is all on one line,
> separated by space. (I've also tried commas)

> I've looked thru google and man pages and don';t see what I'm doing wrong as
> the man page states
> "mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr..."

> Here's the script. It *works* but it does not bcc.

> #! /usr/local/bin/perl

> $reclist = `/bin/cat contact_email.file`;
> $thedate=`/bin/date`;

> `echo "This email notification is being sent to you because you asked for
> it" | mail -s "Your Update" -b $reclist`;

This will work though it isn't a perl script. You will need to edit it
to suit your needs.

#!/bin/sh
#
(
  echo "Bcc: `cat reclist"

  echo "Subject: Your Update"
  echo

  PATH=/sbin:/usr/sbin:/bin:/usr/bin:
  export PATH
echo "Enter a subject line here"
echo "`cat message file here`"
  ) 2>&1 | /usr/lib/sendmail -t
exit 0

--
Confucius say: He who play in root, eventually kill tree.
Registered with the Linux Counter.  http://counter.li.org

 
 
 

BCC mail in script ?

Post by Bob_Parnass_AJ9 » Fri, 22 Mar 2002 07:52:50


Your quote from the mail(1) manual page shows
the 'to-addr' is required.

Send the mail to yourself as the sole recipient and use
the -b flag and bcclist, too.


> I've looked thru google and man pages and don';t see what I'm doing
> wrong as the man page states
> "mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr..."

> Here's the script. It *works* but it does not bcc.

> #! /usr/local/bin/perl

> $reclist = `/bin/cat contact_email.file`; $thedate=`/bin/date`;

> `echo "This email notification is being sent to you because you asked
> for it" | mail -s "Your Update" -b $reclist`;

--
=========================================================================

                           Linux user
 
 
 

BCC mail in script ?

Post by Bob_Parnass_AJ9 » Fri, 22 Mar 2002 08:10:16


Your quote from the mail(1) manual page shows
the 'to-addr' is required.

Send the mail to yourself as the sole recipient and use
the -b flag and bcclist, too.

--
=========================================================================

                           Linux user

 
 
 

BCC mail in script ?

Post by Davi » Fri, 22 Mar 2002 08:27:01


BTW the reclist should use this format.


--
Confucius say: He who play in root, eventually kill tree.
Registered with the Linux Counter.  http://counter.li.org
ID # 123538

 
 
 

1. MAIL PROGRAM...AUTOMATION....BCC????

I'm trying to learn how to automate my mailer and I want to send bcc copies of
a message to multiple files of addresses (comma-delimited).  I've been trying
syntax like this:

mail -s "TEST SUBJECT" -b testlist username < test.txt

Theoretically it should send test.txt to username and bcc those addresses in

the message back to me.    

2. Installation of Solaris

3. Mail problem because a perl script reads /var/spool/mail/login?

4. nntpd

5. How to use command mailx or mail to send mail from within a script

6. cerco Sony Vaio disperatamente

7. Form to Mail Script Won't Mail

8. Report Writer

9. Mail/Csh script/resend mail

10. How do I delete mail from mail file /var/mail/su after reading mails

11. Pine - how to automatically BCC myself?

12. Kmail filter against BCC field? and other...

13. Help - sending list through mailx to bcc: field