Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] Mail() *quickly* From: Rasmus Lerdorf (rasmus <email protected>)
Date: 01/30/99

> I get $done back as 1 so it's been successful but I don't get the mail or else
> it's still in the queue. Either way, I want a way to avoid the delay. Can I do
> this with PHP directly or do I need to open a pipe to sendmail?

The built-in mail() function in PHP just does a popen() to sendmail. You
can do that yourself. There is a user-level popen() call. If you look in
functions/mail.c in the PHP source code you will see this:

    sendmail = popen(php3_ini.sendmail_path, "w");

    if (sendmail) {
        fprintf(sendmail, "To: %s\n", to);
        fprintf(sendmail, "Subject: %s\n", subject);
        if (headers != NULL) {
            fprintf(sendmail, "%s\n", headers);
        }
        fprintf(sendmail, "\n%s\n", message);
        ret = pclose(sendmail);
        if (ret == -1) {
            return 0;
        } else {
            return 1;
        }
    } else {
        php3_error(E_WARNING, "Could not execute mail delivery program");
        return 0;
    }

You can translate this almost verbatum into PHP and create your own mail()
function that calls sendmail the way you want.

Alterntively, you could edit you php3.ini file and change the
sendmail_path setting to call sendmail with the flags you want.

-Rasmus

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>