Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending mail from cgi

Posted on 2000-02-17
5
Medium Priority
?
168 Views
Last Modified: 2010-03-05

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?
0
Comment
Question by:leoleo
5 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 2534199
Return-Path: should only be added on the host that performs final delivery.
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?
0
 

Author Comment

by:leoleo
ID: 2534415

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.

0
 
LVL 3

Expert Comment

by:alien_life_form
ID: 2534558
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).
0
 

Expert Comment

by:Spearmon
ID: 2537400
ive seen a great smtp example at http://616.org doesnt use sendmail and is faster to
0
 
LVL 1

Accepted Solution

by:
kawin earned 200 total points
ID: 2539350
Try this module Mail::Sender it easier than write your own code :) Or you can search other mail sender module from http://search.cpan.org.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question