in reply to Re: close statement issue
in thread close statement issue

... or, escape the sigils:

print MAIL << "EOF"; To: joe\@here.com From: smith\@here.com ... EOF

or, use single quotes around the EOF:

print MAIL << 'EOF'; To: joe@here.com From: smith@here.com ... EOF

Replies are listed 'Best First'.
Re^3: close statement issue
by Anonymous Monk on Mar 01, 2007 at 18:36 UTC
    Thanks, I tried all suggestions and it still only works if I get rid of the close statement. Any other suggestions?

      Don't you get any more detailed error message than "mail not working"? (look in the syslog, MTA logfiles, etc.)

      Anyhow, something like this works fine for me (my incarnation of sendmail needs the -t option to read the addressees from the message headers...):

      #!/usr/bin/perl open MAIL, "| /usr/sbin/sendmail -t" or die "$!"; print MAIL << 'EOF'; To: joe@here.com From: smith@here.com Subject: data subject message body here EOF close MAIL or die "$!";