Sendmail BCC with multiple recipients

E

Erica Coffin

Hello,

I'm completely stuck on this problem I've been having calling sendmail from a perl script.
I can't seem to have multiple bcc recipients. If I have one bcc recipient, the message is received by the one bcc recipient and everything is happy. If I have more than one bcc recipient, the message is sent to the To recipient only, and none of the bcc recipients receive an email.

I am posting here instead of a sendmail NG, because when I copy and paste the output of the print line (from below) everything works great. All the bcc recipients get a copy of the message.

Here is the salient portion of my script:

$sendmail = '/usr/bin/sendmail';
$from = '(e-mail address removed)';
$email = $debug ? $debug_email : $hash{'eMail'};
$subject = 'Your loan application';
$text = 'blah blah blah';
$bcc = '(e-mail address removed), (e-mail address removed), (e-mail address removed)';

open MAIL, "|$sendmail $email"
or die "Unable to start sendmail:$!\n";
print MAIL "From: $from\nBcc: $bcc\nSubject:$subject\n$text";
close MAIL;

Thanks for any help,
erica
 
M

Michael Budash

Hello,

I'm completely stuck on this problem I've been having calling sendmail from a
perl script.
I can't seem to have multiple bcc recipients. If I have one bcc recipient,
the message is received by the one bcc recipient and everything is happy. If
I have more than one bcc recipient, the message is sent to the To recipient
only, and none of the bcc recipients receive an email.

I am posting here instead of a sendmail NG, because when I copy and paste the
output of the print line (from below) everything works great. All the bcc
recipients get a copy of the message.

Here is the salient portion of my script:

$sendmail = '/usr/bin/sendmail';
$from = '(e-mail address removed)';
$email = $debug ? $debug_email : $hash{'eMail'};
$subject = 'Your loan application';
$text = 'blah blah blah';
$bcc = '(e-mail address removed), (e-mail address removed),
(e-mail address removed)';

open MAIL, "|$sendmail $email"
or die "Unable to start sendmail:$!\n";
print MAIL "From: $from\nBcc: $bcc\nSubject:$subject\n$text";
close MAIL;

Thanks for any help,
erica

perhaps you re-typed rather than cut-and-pasted your code, but you will
of course need a blank line after the headers and before the email
body...:

print MAIL "From: $from\nBcc: $bcc\nSubject:$subject\n";
print MAIL "\n";
print MAIL $text;
 
G

Gunnar Hjalmarsson

Erica said:
I can't seem to have multiple bcc recipients. If I have one bcc
recipient, the message is received by the one bcc recipient and
everything is happy. If I have more than one bcc recipient, the
message is sent to the To recipient only,

Really? I don't see any "To:" field in the code you posted here. You'd
better be careful with the code you post when asking for help.
and none of the bcc recipients receive an email.

You posted a very similar question to comp.lang.perl, to which I
replied. That's called multi posting, and is not in compliance with
the netiquette for Usenet.

Why didn't you follow up your initial question?
I am posting here instead of a sendmail NG, because when I copy and
paste the output of the print line (from below) everything works
great. All the bcc recipients get a copy of the message.

That does not make it a Perl programming question.

One idea is that CGI is run with a different user ID, and that
sendmail is configured to not accept multiple bcc recipients from the
CGI user.
$subject = 'Your loan application';
---------------^^^^^^^^^^^^^^^^^^^^^
Are you about to send spam????
print MAIL "From: $from\nBcc: $bcc\nSubject:$subject\n$text";
-----------------------------------------------^^
Missing space.
 
E

Erica Coffin

Gunnar Hjalmarsson ([email protected]) wrote:
: Erica Coffin wrote:
: > recipient, the message is received by the one bcc recipient and
: > everything is happy. If I have more than one bcc recipient, the
: > message is sent to the To recipient only,

: Really? I don't see any "To:" field in the code you posted here. You'd
: better be careful with the code you post when asking for help.

The 'To:' field must be specified on the command line unless you use sendmail -t which I am not. The $email variable contains the recipient email. You can see this on the line:

open MAIL, "|$sendmail $email"

: You posted a very similar question to comp.lang.perl, to which I
: replied. That's called multi posting, and is not in compliance with
: the netiquette for Usenet.

You are correct and I apologize. I posted it there until I saw another post saying that comp.lang.perl was obsolete, so I reposted to this news group.

: > I am posting here instead of a sendmail NG, because when I copy and
: > paste the output of the print line (from below) everything works
: > great. All the bcc recipients get a copy of the message.

: That does not make it a Perl programming question.

It makes it unclear whether it's a Perl programming question, but I think it was hardly unreasonable to post the question here.

: One idea is that CGI is run with a different user ID, and that
: sendmail is configured to not accept multiple bcc recipients from the
: CGI user.

This is not a CGI script.

: > $subject = 'Your loan application';
: ---------------^^^^^^^^^^^^^^^^^^^^^
: Are you about to send spam????

No, I work for a company that distributes loans for business and these emails are for people who are actively working on an application on our website, but thanks for checking.

erica
 
J

James Willmore

Hello,

I'm completely stuck on this problem I've been having calling sendmail from a perl script.
I can't seem to have multiple bcc recipients. If I have one bcc recipient, the message is received by the one bcc recipient and everything is happy. If I have more than one bcc recipient, the message is sent to the To recipient only, and none of the bcc recipients receive an email.

I am posting here instead of a sendmail NG, because when I copy and paste the output of the print line (from below) everything works great. All the bcc recipients get a copy of the message.

Here is the salient portion of my script:

$sendmail = '/usr/bin/sendmail';
$from = '(e-mail address removed)';
$email = $debug ? $debug_email : $hash{'eMail'};
$subject = 'Your loan application';
$text = 'blah blah blah';
$bcc = '(e-mail address removed), (e-mail address removed), (e-mail address removed)';

open MAIL, "|$sendmail $email"
or die "Unable to start sendmail:$!\n";
print MAIL "From: $from\nBcc: $bcc\nSubject:$subject\n$text";
close MAIL;

Thanks for any help,
erica

First - please read the posting guidelines. Set your client to
truncate the lines at a "sane" position - like 72 characters. Those
of us who sometimes use Goggle to read/post to groups have a tough
time reading posts that run off the side of the page :)

Second - try out one of the many email/SMTP modules (such as
Net::SMTP, Mail::Mailer, MIME::Lite, etc) to do what you're doing.
That's just a suggestion and something personal with me - I can't
stand sendmail. Not to mention the fact that, one day, your company
_may_ decide that *NIX isn't cutting it and go with another platform -
one that does _not_ use sendmail. Then you're going to be S.O.L. with
your script that only uses sendmail to send email :)

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top