Exim and Cc: Bcc:

tlchost

Verified User
Joined
Apr 4, 2007
Messages
320
Does anyone have a cgi based script that allows user feedback to
be sent to one email address, with a option to send the user a copy and a Bcc to another address? It would be nice if it also could save the response to a data file.

I have at least 3 scripts that do exactly that when run on a RaQ, and other flavors of servers that use sendmail.

It's getting real frustrating having customers tell me that the server move is making their life misearble because stuff is busted. :(

But Hey....they're only customers, who listens to them anyway.

Thom
 
Any cgi script that runs on a Raq will also run on DA. DA servers provide a link from /usr/sbin/sendmail to /usr/sbin/exim. So anything that uses sendmail will get sent to exim. So if your cgi's are busted its not because they use sendmail unless the path to sendmail is wrong in the script.
 
Any cgi script that runs on a Raq will also run on DA. DA servers provide a link from /usr/sbin/sendmail to /usr/sbin/exim. So anything that uses sendmail will get sent to exim. So if your cgi's are busted its not because they use sendmail unless the path to sendmail is wrong in the script.

Not that I would disagree with anyone...but empirical evidence indicates that your statement is not accurate.

I even believe that a search of the forum would point you to some questions/observations/complaints from others about how exim handles(or doesn't, depending on your outlook)Cc and Bcc.

http://www.directadmin.com/forum/showthread.php?t=5759

I am really mystified....if the script looks for sendmail in /usr/sbin/sendmail, and that's exactly where is is on a RaQ, then we should be able to eliminate
the script having the wrong path.

I suppose the scripts that I have used on RaQs, and Sun, and other places just don't contruct things in such a way that makes exim happy.

Thom
 
My statements are based on my own observations. This code works perfectly with exim:

open(SENDMAIL, "| /usr/sbin/sendmail -t -n");
print SENDMAIL "To: floyd\@newwebsite.com\n";
print SENDMAIL "Cc: newwebsite1\@yahoo.com\n";
print SENDMAIL "Bcc: newwebsite2\@hotmail.com\n";
print SENDMAIL "From: server\@server.newwebsite.com\n";
print SENDMAIL "Subject: test\n";
print SENDMAIL "Test email";
close(SENDMAIL);

See http://www.directadmin.com/forum/showthread.php?p=102387&posted=1#post102387
 
Last edited:
Thom,

Don't assume you've got a working link at /usr/sbin/sendmail; verify.
Code:
$ whereis sendmail
or
Code:
$ ls -al /usr/sbin/sendmail
Once you've verified that's correct, then you shouldn't have a problem with your script not finding sendmail; if it does, check the script, to make sure it's got everything right, and that it was uploaded as ascii.

My working copy of FormMail.pl includes this line:
Code:
$mailprog = '/usr/sbin/sendmail';
and it works. Your program may have a different way of calling sendmail, but the path should work.

And make sure you're using CC: and Bcc:; in your example in the other thread you've used lower case. I don't know if that's important or not, but give it a try.

Jeff

Jeff
 
Thom,

Don't assume you've got a working link at /usr/sbin/sendmail; verify.
Code:
$ whereis sendmail

As I posted before:
whereis sendmail
/usr/sbin/sendmail /usr/lib/sendmail

Not sure why two locations, but both report from the prompt:
Exim is a Mail Transfer Agent. It is normally called by Mail User Agents,
not directly from a shell command line. Options and/or arguments control
what it does when called. For a list of options, see the Exim documentation.

Once you've verified that's correct, then you shouldn't have a problem with your script not finding sendmail; if it does, check the script, to make sure it's got everything right, and that it was uploaded as ascii.

My working copy of FormMail.pl includes this line:
Code:
$mailprog = '/usr/sbin/sendmail';
and it works. Your program may have a different way of calling sendmail, but the path should work.

And make sure you're using CC: and Bcc:; in your example in the other thread you've used lower case. I don't know if that's important or not, but give it a try.

Tried both Cc, cc. Bcc, bcc same result.

I'll just keep on hunting for a script that does what I want and works with Exim.

Thanks, though
 
My statements are based on my own observations. This code works perfectly with exim:

Was that code generated by a script? If who which one? One of my questions was asking if anyone had a script that handled, the Cc, Bcc, sent the poster an email of his/her submission, and wrote a data file.

I would really appreciate knowing of such a script.

Thom
 
I would really appreciate knowing of such a script.

FormMail.pl from http://www.scriptarchive.com

Likely your current scripts have a place to define the variable for the mail program. The value should be "/usr/sbin/sendmail -t" unless the script later adds the -t. Your example did not have the -t.

Its not a problem with sendmail or exim. Its a problem with the script.
 

As I recall, Matt's formmail, even in later versions wasn't that secure.

Likely your current scripts have a place to define the variable for the mail program. The value should be "/usr/sbin/sendmail -t" unless the script later adds the -t. Your example did not have the -t.

Its not a problem with sendmail or exim. Its a problem with the script.

Well, I didn't post the entire script....just the section that showed the variables....and it does have $mail = "/usr/sbin/sendmail -t";

This thread is getting pointless...people telling me that most likely the script wasn't calling sendmail, or that sendmail wasn't installed where the script thought it was, or that the -t wasn't specified.

But none of that is the case....and the very same script(s) work fine when the system uses sendmail.

I suspect that the syntax/logic used by Exim is just enough different than that used by sendmail to cause certain scripts not to function as expected.

Thom
 
FormMail.pl is only insecure if the person using it doesn't set it up properly. I have never had it exploited.

The exact code you posted in the other thread works with the one modification I made, namely the -t option. This works.

$mailprog = "/usr/sbin/sendmail";
$mailaddr = "floyd\@newwebsite.com";
$mailname = "Floyd Morrissette";
$email = "newwebsite1\@yahoo.com";
$secretaddr = "sales\@newwebsite.com";

open(MAIL,"|$mailprog -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "bcc: $mailaddr\n";


open(MAIL,"|$mailprog -t -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "cc: $mailaddr,$secretaddr\n";

I have also tried this code and it works:

Code:
$mailprog = "/usr/sbin/sendmail -t";
$mailaddr = "floyd\@newwebsite.com";
$mailname = "Floyd Morrissette";
$email = "newwebsite1\@yahoo.com";
$secretaddr = "sales\@newwebsite.com";

open(MAIL,"|$mailprog -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "bcc: $mailaddr\n";


open(MAIL,"|$mailprog -t -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "cc: $mailaddr,$secretaddr\n";


That is why I say it is a script problem. If you posted a link to the entire script we could take a look at it and find the problem. Something is either wrong with the script or with your server setup.

And yes it is pointless when you do not answer the questions like what is the output of /usr/sbin/sendmail

And you still have not answered Jeff's question:
ls -al /usr/sbin/sendmail

Why don't login through SSH and copy and past the code I posted into a file and run it from your server. Then we will see if that works.
 
FormMail.pl is only insecure if the person using it doesn't set it up properly. I have never had it exploited.

Well, I will have to accept that, just as you accept my statements that the script in question works fine on servers that use sendmail instead of Exim.

The exact code you posted in the other thread works with the one modification I made, namely the -t option. This works.



I have also tried this code and it works:

Code:
$mailprog = "/usr/sbin/sendmail -t";
$mailaddr = "floyd\@newwebsite.com";
$mailname = "Floyd Morrissette";
$email = "newwebsite1\@yahoo.com";
$secretaddr = "sales\@newwebsite.com";

open(MAIL,"|$mailprog -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "bcc: $mailaddr\n";


open(MAIL,"|$mailprog -t -f $mailaddr");
print MAIL "From: $mailaddr ($mailname)\n";
print MAIL "Reply-to: $mailaddr\n";
print MAIL "To: $email\n";
print MAIL "cc: $mailaddr,$secretaddr\n";


That is why I say it is a script problem. If you posted a link to the entire script we could take a look at it and find the problem. Something is either wrong with the script or with your server setup.

And yes it is pointless when you do not answer the questions like what is the output of /usr/sbin/sendmail

And you still have not answered Jeff's question:

And so....here it is
/usr/sbin/sendmail -> exim

Thanks for the suggestions....I believe I will submit the problem to the company that sells the script generation program.....let them tell me what I did wrong, or that their product is defective.

Thom
 
Thom,

Our version of FormMail.pl, found here, is quite secure; we've been using it for years. It sends an email whenever anyone tries to attack it.

But I don't know if it has code lines for Cc or for Bcc; it's been a while since I've looked into it.

What's important is that the Bcc or Cc code be hardcoded in, so that the emails can't be sent out to addresses inserted by spammers.

If you're going to look at it be sure to read the readme before downloading it.

Jeff
 
Back
Top