Web Hosting Talk







View Full Version : CRON job / CGI help


Matthew.A
11-26-2001, 05:28 AM
Hello gang :)

I have a cron job that runs nightly sending out emails via a CGI script. However the e-mails are being sent with headers like so:
============================
Return-Path: <007admin>
Received: (from 007admin@localhost)
============================
How can I get the e-mails to go out so that they report as so?
============================
Return-Path: <Failures>
Received: (from Failures@website.com)
============================

(On a Cobalt RAQ4)

Thanks

ffeingol
11-26-2001, 08:04 AM
Can you give some more details on how you are sending the mail? Is the CGI program perl? Are you opening a pipe to sendmail?

Frank

Matthew.A
11-26-2001, 01:42 PM
Yes it's a perl program, and the actual mail routine is as follows

sub dosendmail($) {
my($toname,$toemail,$from,$subject,$body) = @_;
unless(open(MAIL,"|/usr/sbin/sendmail -t")) {
print "Unable to open sendmail binary.";
exit;
}
print MAIL "To: $toname<$toemail>\n";
print MAIL "From: e-mail remind<$from>\n";
print MAIL "Subject: $subject\n";
print MAIL "$body\n\n";
close(MAIL);
}

This is something I wrote myself (if you can't tell) but I'm no expert...Thanks for any advise / help...

ffeingol
11-26-2001, 02:54 PM
I don't believe you can override/change these headers. They are added by each MTA as the mail moves along.

Frank

Matthew.A
11-26-2001, 03:58 PM
Well not quite what I wanted to hear :(

Is there another way to do it?