sendmail doesn't work, but no error on the screen...


V

Vit

Hi all,

I'm trying to debug my file.... it works (no error in the browser!!!),
but it is not doing what I'd like to...

#!/usr/bin/perl

&send_email;

sub send_email
{
$to = "vit\@domain.com";
open(MAIL, "|/usr/sbin/sendmail");

print MAIL "From: bob\@domain.com\n";
print MAIL "To: $to\n";
print MAIL "Subject: Web Enqiry\n\n";

close (MAIL);
}

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

it doesn't give me an error, but I dont receive any mail....

any suggestion???

thanks

Vit
 
Ad

Advertisements

R

RedGrittyBrick

Vit said:
Hi all,

I'm trying to debug my file.... it works (no error in the browser!!!),
but it is not doing what I'd like to...

#!/usr/bin/perl

&send_email;

sub send_email
{
$to = "vit\@domain.com";
open(MAIL, "|/usr/sbin/sendmail");

print MAIL "From: bob\@domain.com\n";
print MAIL "To: $to\n";
print MAIL "Subject: Web Enqiry\n\n";

close (MAIL);
}

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

it doesn't give me an error, but I dont receive any mail....

any suggestion???

See my answer to your earlier copy of this question in a different thread.
 
A

Andrzej Adam Filip

Vit said:
Hi all,

I'm trying to debug my file.... it works (no error in the browser!!!),
but it is not doing what I'd like to...

#!/usr/bin/perl

&send_email;

sub send_email
{
$to = "vit\@domain.com";
open(MAIL, "|/usr/sbin/sendmail");

open(MAIL, '|-', '/usr/sbin/sendmail -t -oi') or die;

1) Use of three params open is recommended.
2) You have missed important sendmail's command line parameters
-t - get recipient addresses from the message
-oi - "single do line" is not "end of message"
 
V

Vit

open(MAIL, '|-', '/usr/sbin/sendmail -t -oi') or die;

1) Use of three params open is recommended.
2) You have missed important sendmail's command line parameters
-t  - get recipient addresses from the message
-oi - "single do line" is not "end of message"

thanks, I will try!!!
 
Ad

Advertisements

T

Tad J McClellan

Andrzej Adam Filip said:
open(MAIL, '|-', '/usr/sbin/sendmail -t -oi') or die;

If the filehandle is connected to a pipe, it is a Really Good Idea
to check the return value from close() too:

close(MAIL) or die "sendmail failed";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top