Re: problem sending mail
[email protected] ("Skymarket Postmaster") Thu, 11 Apr 2002 09:30:59 +0100
| Newsgroups | perl.scripts,perl.beginners.cgi,perl.beginners |
|---|---|
| Message-ID | <007001c1e133$375cb9d0$0db354d4@kingsley> |
> Hi all > I am trying to send a mail with the following code and the last print > statement doesn't print, ie, the mail is not sent. > This code is called on submitting a form on the web > -------------------- > open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail"; > print MAIL <<END; > To: amancgiperl\@hotmail.com > Subject: News > all the message goes here > END > > close(MAIL); > print "The mail has been sent successfully<BR><BR>"; > --------------------- You're missing the pipe symbol before /usr/sbin/sendmail so it's probably going to try to open the file for read - not what you intented. As others have suggested, put a check on the close as well, eg: close (MAIL) or die "Could not send mail: $!\n"; Cheers, Kingsley.