Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Mail program problem...

Hi folk,

I am having one stupid propblem with the /bin.mail program:
I am triaying to send one email from one cgi, but when the user to receive the message, the sender is "nobody"!!!

How can I to fix it???
Pelase help me!!

This the code:

open (MEN,$mailtext) || die "No pude abrir el mensaje";
open(MAIL,"| $mailprog $email");  
print MAIL "From: $sender\n";
print MAIL "To: $email\n";
print MAIL "Subject: $subject\n\n";

while (<MEN>){
    print MAIL;
}
close(MAIL);
close(MEN);
0
hakimus
Asked:
hakimus
1 Solution
 
maneshrCommented:
nobody is the default user under whom CGI scripts are executed.

if you want to instead use some other user then try this..
$sender="somebody\@somwhere.com";
$mailprog="/usr/bin/sendmail -t ";

open (MEN,$mailtext) || die "No pude abrir el mensaje";
open(MAIL,"| $mailprog") || die $!;

print MAIL "From: $sender\n";
print MAIL "To: $email\n";
print MAIL "Subject: $subject\n\n";

while (<MEN>){
  print MAIL;
}
close(MAIL);
close(MEN);
0
 
hakimusAuthor Commented:
Thanbks !!
It's easy!!

The points  are yours!!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now