I can't get a Bcc to work on a perl cgi script. The rest of the script
works fine, but the Bcc doesn't come through. Here's the first part of
my script:
$mailprog = '/usr/lib/sendmail';
%params=&getdata;
&domail;
sub domail {
open(MAIL,"|$mailprog -t");
print MAIL "From: $params{'email'}\r\n";
print MAIL "To: $params{'mailto'}\r\n";
print MAIL "Bcc: $params{'bcc'}\r\n";
print MAIL "Subject: $params{'mailsubj'}\n\n";
print MAIL "$params{'namel'}\n\n";
print MAIL "$params{'email'}\n\n";
{ print "Location: www.website.co.uk/page.html\n\n"; }
close (MAIL);
exit;
}
and here's the line that passes the Bcc, from the form:
<input type="hidden" name="bcc" value="me@myaddress.co.uk">
Both the cgi and the page which calls the cgi are hosted on a Linux
server.
I'd be really grateful for any advice on something I might be
overlooking here.
Thanks very much! |
Request for Question Clarification by
webadept-ga
on
10 Sep 2003 16:53 PDT
Just a quick note here, your line
<input type="hidden" name="bcc" value="me@myaddress.co.uk">
is the program sqawking at all aboutthe @ sign in there? Try
hardcoding the address once with the bcc value of
"me\@myaddress.co.uk";
and see if that works.
webadept-ga
|
Request for Question Clarification by
webadept-ga
on
10 Sep 2003 16:56 PDT
OH.. wait.. are you sending both of these, the To email and the Bcc
email to the same place? That would be your precieved problem. BCC
works different than CC, CC you will get the copy, BCC you won't, BCC
seperates the addresses out and sends one copy to each address, only
one.
webadept-ga
|
Clarification of Question by
horseradish-ga
on
10 Sep 2003 23:52 PDT
I will try the backslash but I am sure this isn't it because the
mailto DOES work and that doesn't have a backslash.
Also I am sending to two different addresses.
Thanks for your help.
|
Request for Question Clarification by
webadept-ga
on
11 Sep 2003 00:47 PDT
Okay, this code works on mine. I took out the \r you have in the
header lines, and hard coded the addresses. The BCC works with this.
See if it works with your two addresses.
#! /usr/local/bin/perl
$mailprog = '/usr/lib/sendmail';
&domail;
sub domail {
open(MAIL,"|$mailprog -t");
print MAIL "From: glennh\@mydomain.net\n";
print MAIL "To: glennh\@mydomain.net\n";
print MAIL "BCC: root\@mydomain.net\n";
print MAIL "Subject: test email\n";
print MAIL "line1\n\n";
print MAIL "line2\n\n";
{ print "Location: www.website.co.uk/page.html\n\n"; }
close (MAIL);
exit;
}
I'm guessing you are on a Linux Box? What OS are you running, what
Perl and what Sendmail? If this doesn't work for you, then it's a
system thing and we'll need to start there, because it works fine on
mine.
webadept-ga
|