Date: Mon, 10 Jul 2000 09:37:21 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Olaf van der Spek cc: djgpp AT delorie DOT com Subject: Re: Pipe to sendmail (again) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 9 Jul 2000, Olaf van der Spek wrote: > I tried the following code with g++ on a Unix Apache server. > #include > #include > #include > > int main() > { > FILE* mail = popen("/usr/sbin/sendmail", "tw"); > cout // << errno << endl > << mail << endl; > return 0; > } > > The errno is commented because g++ complained about an undeclared > identifier. > I get NULL as result, meaning the pipe couldn't get opened. `sendmail' must have at least one address on its command line, otherwise it won't know where to send the message. Also note that you need to call `pclose'. It's quite possible that, since you only write a few characters to the pipe, without `pclose' those characters are buffered somewhere and don't get delivered to `sendmail' at all.