leoleo
asked on
Sending mail from cgi
Hi,
I use sendmail program to send mails from my CGI program, like this:
open(SEND_MAIL, "|/usr/sbin/sendmail -t");
print SEND_MAIL "To\: $to\n";
print SEND_MAIL "From\: $from\n";
print SEND_MAIL "Subject\: $subject\n\n";
print SEND_MAIL $body;
print SEND_MAIL "\n\n";
close(SEND_MAIL);
When the mail reaches the recipient, the "to", "from" etc values are all correct, just as I had given, but in the header, I see the "return-path" as "nobody". I want the "from" address itself to be seen as the return-path.
What can be done?
ASKER
Isn't Return-Path used if the mail bounces ?
I want it to be the same as the 'from' address. I have seen automatically generated mails from several sites which have the 'from' address at the Return-Path header as well. So I know it's possible.
One way would be to use the -f switch
to sendmail (sendmail -f foo -bt). This requires 'trust' privileges, and I doubt if it's wise to grant them to 'nobody', which is probably the user your webserver is running under.
Another way would be making the script
suid to some real user (the From: user).
to sendmail (sendmail -f foo -bt). This requires 'trust' privileges, and I doubt if it's wise to grant them to 'nobody', which is probably the user your webserver is running under.
Another way would be making the script
suid to some real user (the From: user).
ive seen a great smtp example at http://616.org doesnt use sendmail and is faster to
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In general, it should never be used for replying to mail. It is solely intended to be used for notification of delivery errors.
Perhaps you wanted to set the Reply-To: header?