RE: sendMail in cgi program
This is not for CGI however, the problem is simple. EOF must be at the beginning of the line, no white space in front of it o _ /|/ | Jerrad Pierce \ | __|_ _| /||/ http://pthbb.org . | _| | \|| _.-~-._.-~-._.-~-._@" _|\_|___|___| > -Original Message- > From: amy [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 12, 2000 15:55 > To: [EMAIL PROTECTED] > Subject: sendMail in cgi program > > > if I run the same procedure on a separate file, > email works, once I put the proc in the cgi > file, I got the following error. > > in error_log : > Can't find string terminator "EOF" anywhere before EOF at > /usr/local/bin/apache/cgi-bin/lib.pl line 484. > > sub sendEmail { > > open (Sendmail, "|/usr/lib/sendmail -oi -t ") > or die "Can't fork for sendmail: $!\n"; > > 484 print Sendmail <<"EOF"; > From: Bugs > To: amy > Subject: Test Create > > test create > > EOF > close(Sendmail); > > } > > Please help. Thank You. >
[OT] Re: sendMail in cgi program
I know you've received other responses, but I'm doing a good bit of this lately. > sub sendEmail { > open (Sendmail, "|/usr/lib/sendmail -oi -t ") > or die "Can't fork for sendmail: $!\n"; > print Sendmail <<"EOF"; > From: Bugs > To: amy > Subject: Test Create > test create > EOF > close(Sendmail); > } As someone mentioned on the board (ever so briefly), here-documents like this one require that your "sentinel" string have no leading whitespace. e.i., you may say $var=start_html(-title => $title, -script => $JS, # the above JavaScript -onLoad => "foo($x);", ), "\n"; #__ The biggest problem (for me, anyway) is that it throws off my formatting to have to stick in that line with no leading whitespace. I do it anyway a lot of the time, but if that's a problem, there's always (well, usually, lol) qq{}. e.g., the above example, rewritten, would be $var = qq{ blah }; Again, forgive me if you knew that. As a seperate problem, your example has whitespace in front of the "From:", "To:" and "Subject:" headers as well -- I can't say I'm an expert on those, but does that work? Might want to test it to be sure. In the end, all things considered, it might work better to just build it the hard way -- print Sendmail "To:...\n", "From:...\n", "Subject:...\n\n", # note double newline # content stuff here "\n"; One more consideration -- I believe the specs demand a blank line after all the headers, to signify that "the text starts *here*". Hope that helps. =o) And if not, sorry for rambling so! lol! Paul "Government should be like cooking a small fish -- don't overdo it." -- Lao Tzu __ Do You Yahoo!? Yahoo! Photos -- now, 100 FREE prints! http://photos.yahoo.com
Re: [OT] Re: sendMail in cgi program
Well, you _can _ do this $var=<<"END"; This is my variable's multiline text, complete tith tabs\t\t and extra newline\n\n, etc END four spaces in the opening and closing quote. I usually use qq{ } depending on how much I care about whitespace formatting. If I was writing Perl code to generate Python code, I'd be in trouble (in more than one way). Paul wrote: > As someone mentioned on the board (ever so briefly), here-documents > like this one require that your "sentinel" string have no leading > whitespace. > > e.i., you may say >$var=< This is my variable's > multiline text, > complete tith tabs\t\t and extra newline\n\n, etc > END > > but you *can't* say >$var=< blah >END > > because here, END has space in front of it. > In several shells you can put tabs in front of it if you say >print<<-END; # the dash says "let me use a leading tab" >blah > END -- Salon Internet http://www.salon.com/ Manager, Software and Systems "Livin' La Vida Unix!" Ian Kallen <[EMAIL PROTECTED]> / AIM: iankallen / Fax: (415) 354-3326