BCC not working

clickedit

New member
Joined
May 23, 2007
Messages
1
Hello Friends,

Please check the below cgi script. To email is working fine, but BCC is not working. Kindly let me know the problem and how to fix it.

Thanks in advance,
Rajesh.





#!/usr/bin/perl


$adminemail = "rtavakari\@gmail.com";
$mail2 = "tavakari\@yahoo.com";
$mailprogram = "/usr/sbin/sendmail";
&form_parse;



$email=$FORM{'email'};
$firstname=$FORM{'firstname'};
$lastname=$FORM{'lastname'};
$org=$FORM{'org'};
$role=$FORM{'role'};
$country=$FORM{'country'};
$phone=$FORM{'phone'};
$eNewsletter=$FORM{'eNewsletter'};

$bsp=$FORM{'bsp'};
$npsi=$FORM{'npsi'};
$nmes=$FORM{'nmes'};
$nvsd=$FORM{'nvsd'};
$bpi=$FORM{'bpi'};
$isi=$FORM{'isi'};
$itflp=$FORM{'iftlp'};
$cir=$FORM{'cir'};

$sa=$FORM{'sa'};
$sip=$FORM{'sip'};
$im=$FORM{'im'};
$iab=$FORM{'iab'};
$itpsw=$FORM{'itpsw'};
$icp=$FORM{'icp'};
$contactme=$FORM{'contactme'};


$message=$FORM{'message'};
$message =~ s/ /\|/g;
$message =~ s/\s/\|/g;
$message =~ s/\|+/ /g;



print "Content-type: text/html\n\n";

&errcheck;
&emailadmin;
&emailclient;
&printconfirmation;

############################################################
# EMAIL WELCOME MESSAGE
############################################################
sub emailadmin {
open (MAIL, "| $mailprogram $adminemail");
print MAIL "From:$email\n";
print MAIL "To:$adminemail\n";
print MAIL "bcc:$mail2\n";
print MAIL "Subject: Consultation\n\n";
print MAIL <<ENDWELCOMEEMAIL;
_______________________________________________________________________
Message Posted by $firstname
_______________________________________________________________________


First Name :$firstname
Last Name :$lastname
Organisation :$org
Role :$role
Email :$email
Country :$country
Telephone :$phone
eNewsletter :$eNewsletter

Business Strategy and Planning :$bsp

New Product and Service Innovation :$npsi

New Market Entry Strategy :$nmes

New Venture Strategy and Development :$nvsd

Business Process Innovation :$bpi

Internet Strategy and Implementation :$isi

Industry Foresight :$itflp

Customer Insight Research :$cir

Strategic Alignment :$sa

Sustainable Innovation Processes :$sip

InnovationPoint's methodologies :$im

Innovation Assessments :$iab

Innovation Training & Problem Solving Workshops :$itpsw

Innovation Communities of Practice :$icp

I'd like to learn more. Please contact me : $contactme

Message:
----------------

$message
----------------



------------------------------------------------------------------------------------------------
ENDWELCOMEEMAIL
}

sub emailclient {
open (MAIL, "| $mailprogram $email");
print MAIL "Reply-to: $adminemail\n";
print MAIL "From: $adminemail\n";
print MAIL "To: $email\n";
print MAIL "Subject: Thank you for contacting IPoint.\n\n";
print MAIL <<CLIENTMAIL;

Dear $firstname,

Thank you for your interest in IPoint. We will contact you as soon as possible.

Best regards,

Derrick
Principal





CLIENTMAIL
}




############################################################
# FORM PARSE
############################################################
sub form_parse {
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/\'//g;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
sub printconfirmation
{
print<<CONF;

<html>
<head>
<title>InnovationPoint</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<center>
<p> </p>
<p><font size="3" face="Verdana, Arial, Helvetica, sans-serif" color="#000066"><b>Thank
you for contacting IPoint</b></font><font size="3" face="Verdana, Arial, Helvetica, sans-serif" color="#000066"><b><br>
<br>
<br>
Your message has been sent.</b></font> </p>
</center>
<p align="center"> </p>
<p align="center"><a href="javascript:window.close();"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Close
Window</font></a> </p>
</body>
</html>



CONF
}


sub errcheck {



if ($name eq "")
{
$Message="Error! Name is required!";
&Mess;
exit;
}

if ($email eq "")
{
$Message="Error! Email is required!";
&Mess;
exit;
}

if ($firstname eq "select")
{
$Message="Error! Please select the package!";
&Mess;
exit;
}



}





sub Mess
{

print<<MESS;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Inc.</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>

<script language="JavaScript">
<!--
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>

<SCRIPT LANGUAGE = "JavaScript">
<!-- hide it from old browsers
function back()
{
history.go(-1);
}
// -->
</SCRIPT>
</HEAD>
<BODY aLink=#990000 bgColor=#ffffff leftMargin=0 link=#0000CC
topMargin=0 marginheight="0" marginwidth="0">
<p> </p>
<p> </p>
<p> </p>
<div align="center">
<p><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="3"><b>Error !</b></font> </p>
</div>
<p align="center"><b><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="3">$Message</font></b></p>
<div align="center">
<p>  </p>
</div>
<form method="POST">


<p align="center"><input type="button" value="Back" onClick="back()"></p>
</form>
<p align="center"> </p>
<p> </p>
</BODY></HTML>


MESS
}
 
Hello Friends,

Please check the below cgi script. To email is working fine, but BCC is not working. Kindly let me know the problem and how to fix it.

$adminemail = "rtavakari\@gmail.com";
$mail2 = "tavakari\@yahoo.com";
$mailprogram = "/usr/sbin/sendmail";
&form_parse;

From my own frustrating experience with scripts and Exim...contrary to what the experts pronounce, some scripts, while they work with sendmail, simply don't function correctly with Exim when you attempt to send Cc, cc, Bcc or bcc copies.

Folks will tell you that you need the -t switch for sendmail(Exim) and you should try that. Some folks will also tell you that you need Bcc not bcc, or Cc, not cc ...even though you've used the lower case versions with sendmail.

Once doing that, if the script works, can you tell us if it's one you wrote yourself, or one that was generated by some type of application. If it still doesn't work, it would be helpful to know what generated it...simply so I can add it to my list of "Applications to Avoid". Of course if it's one that was generated by some application, and you can get it to work, I'd love to know which one.

Hope it works for you.

Thom
 
The -t switch should be used even if you are using sendmail. I have been writing perl scripts that send out mail long before I touched exim and I have always used the -t switch. When I moved to exim everything still worked. I use my scripts for monitoring server statuses and have the email go to different places if something is down.

Sendmail man page:

-t
Read message for recipients. To:, Cc:, and Bcc: lines will
be scanned for recipient addresses. The Bcc: line will be
deleted before transmission.

Exim man page:

-t
When Exim is receiving a locally-generated, non-SMTP message on its standard input, the -t option causes the recipients of the message to be obtained from the To:, Cc:, and Bcc: header lines in the message instead of from the command arguments. The addresses are extracted before any rewriting takes place and the Bcc: header line, if present, is then removed.
 
The -t switch should be used even if you are using sendmail. I have been writing perl scripts that send out mail long before I touched exim and I have always used the -t switch.

I have always used the -t switch....but that's not the issue.....the issue is that some scripts, most likely generated by applications, do something with the Bcc and/or Cc in such a way that Exim doesn't handle them.

Hopefully the gentleman who posed the question will tell us how his script was generated.

When I moved to exim everything still worked.

And many of my scripts that were generated by applications and that worked on systems that use sendmail stopped handling the Bcc and Cc lines when I moved to Exim.

Thom
 
And many of my scripts that were generated by applications

Then your problem is with the script generation program. It is flawed.
 
Folks will tell you that you need the -t switch for sendmail(Exim) and you should try that.

Not folks. Sendmail and Exim say it. They are the ones we should listen to.

Some folks will also tell you that you need Bcc not bcc, or Cc, not cc ...even though you've used the lower case versions with sendmail.

Again Sendmail and Exim say it not just some random polling of people.
 
Then your problem is with the script generation program. It is flawed.

It is flawed ONLY if you accept the logic that the true test of flawlessness is Exim. If however one is not so parocial, one has to wonder why the flawed application that produces falwed code does it in such a way that it workds with Sendmail?:D

That being said, none of this thread is:

A. Solving the original poster's problem
and
B. Identifying script generation programs that work with Exim.

It reminds me of the old routine:

"Bob, why are you beating your head with a hammer?"

"Because it feels so good when I stop."

Thom
 
Ok I will stop. If you won't listen to Exim or even Sendmail then we cannot help you any more.

clickedit, if you want more help from me send me a PM. I am done reading this thread.
 
Ok I will stop. If you won't listen to Exim or even Sendmail then we cannot help you any more.

clickedit, if you want more help from me send me a PM. I am done reading this thread.

What a farce! I keep on pointing out that some scripts that work with sendmail don't work with Exim....you simply can't admit it, so you muddy the water.

But, the upside is that you've offered to help clickedit.
 
Look at it this way, Thom. We (the people reading the thread) aren't having the problem you're having. That makes it hard for us to help you. Send me a script that doesn't work (as an attachment to an email, with a .txt filename ending) and I'll try installing it on my system and checking it.

Jeff
 
Look at it this way, Thom. We (the people reading the thread) aren't having the problem you're having. That makes it hard for us to help you.

Please look at the first message in this thread....it is from someone other than me who is having a problem.

Send me a script that doesn't work (as an attachment to an email, with a .txt filename ending) and I'll try installing it on my system and checking it.
Jeff

Please look at the first message in this thread. The person having a problem with the Bcc posted his script.

I appreciate the offer.....what I am trying to do is find an application that will generate a script that does work with Exim....apparently there are more than the two I have tried that don't.

Thanks

Thom
 
Back
Top