Forum Moderators: coopster & phranque

Message Too Old, No Replies

Perl Sendmail ignores bcc

Can't get sendmail to pickup the blind copy

         

nacho_man

12:36 pm on Sep 6, 2004 (gmt 0)

10+ Year Member



I have been trying to send email via a perl script and sendmail. Worked fine until recently I needed to have the script send a Blind Carbon Copy of the email aswell.

I have filled in the bcc: field but it never sends the mail. I then tried to add a second recipient to see if that worked but it only sends to the first emaill address in the list. Listed below is a code fragment from the script. $to and $bcc hold the email addresses.

$bcc - the email address for this actually appears in the message body, suggesting that sendmail is not recognising Bcc: as header information. If two address are input for the To: field then when I get the email both are shown as recipients but only the first email is actually sent.

open (SENDMAIL, "¦ $sendmailpath -t");
print SENDMAIL "Subject: Order confirmation\n";
print SENDMAIL "To: $to\n";
print SENDMAIL "Bcc: $bcc\n";
print SENDMAIL "From: orders\@mydomain.co.uk\n";

print SENDMAIL "Dear ";
print SENDMAIL "$name \n\n";
.........

Anyone seen this before or know where I am going wrong?

Thanks in advance for any help

Kind Regards

Tony Hyams

IanKelley

10:08 pm on Sep 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you tried BCC instead of Bcc? Also, put BCC after From.

nacho_man

3:13 am on Sep 8, 2004 (gmt 0)

10+ Year Member



Hi Ian,

Made the changes as suggested and the BCC: field no longer appears in the message body but the BCC: address is not sent still.

Any other thoughts?

Thanks

IanKelley

3:37 am on Sep 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, there should be two newlines between the header and body:

print SENDMAIL "From: orders\@mydomain.co.uk\n";
print SENDMAIL "BCC: $bcc\n\n";

nacho_man

12:05 am on Sep 10, 2004 (gmt 0)

10+ Year Member



Thanks very much, changing the order and adding the extra \n has done the trick.

Thanks for taking your time to supply the solution.

Much Appreciated

Tony Hyams