Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot send mail

Status
Not open for further replies.

michael12

Programmer
Sep 26, 2002
25
US
I tried to send mail and failed:
1)
$recv="recipient\@host.com";
open(MAIL,"|/usr/lib/sendmail -t");
print MAIL "To: $recv\n";
.....

but this works:
2)
open(MAIL,"|/usr/lib/sendmail -t");
print MAIL "To: recipient\@host.com\n";
.....

is my 1) coding wrong, how to fix it?
 
hi,

use the below code and it will sure work as it work on my server.

#!/usr/bin/perl

print "Content-type:text/html\n\n";

$mailprog = '/usr/lib/sendmail';

$recipient = 'you@yourdoman.com';
$from = 'you@yourdomain.com';

open (MAIL, "|$mailprog -t");

print MAIL "To: $recipient\n";
print MAIL "From: $from\n";
print MAIL "Subject: Your Subject\n\n";
print MAIL "This will be the body\n";

close(MAIL);

print "message sent";



regards,

Xtravel
==============================================
Visit my site: ==============================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top