On Fri, Sep 08, 2006 at 11:52:47AM -0700, Bryan Irvine wrote:
> i have a peice of code that doesn't seem to work.  It compiles and
> even executes fine but the email never goes anywhere.
> 
> maillog doesn't even show anything trying. Apache is not running 
> chrooted.
> 
>       #define SENDMAIL_PATH "/usr/sbin/sendmail -t"
>       #define RECIPIENT "[EMAIL PROTECTED]"
>       #define SENDER "From: [EMAIL PROTECTED]"
>       FILE *mail;
>       char sendmail[512];
>       
>       sprintf(sendmail, "%s %s", SENDMAIL_PATH, RECIPIENT);
>       
>       mail = popen(sendmail, "w");
>       
>       fprintf(mail, "From: [EMAIL PROTECTED]");
>       fprintf(mail, "Subject: test email.\n");
>       fprintf(mail, "\n");
>       fprintf(mail, "blah\n");
>       
>       pclose(mail);
> 
>       
> also worth noting that i'm a terrible C programmer.  It's possible
> that elsewhere I have a bug, but I just want to eliminate whether 
> www can even execute sendmail.

If I am correct in assuming that you run this under Apache, you forgot
to take care of the chroot environment. Install the chroot flavour of
mini_sendmail.

Checking the return values from popen() and pclose() would almost
certainly have caught this, BTW.

Finally, could I point you to the fcgi package? It might be very useful
if you're trying to do CGIish stuff from C. Notably, it allows you to be
even faster. ;-)

                Joachim

Reply via email to