#42967 [Opn->Bgs]: imap_mail() does not use imap on Unix

From: Date: Mon, 15 Oct 2007 09:58:34 +0000
Subject: #42967 [Opn->Bgs]: imap_mail() does not use imap on Unix
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118538@lists.php.net to get a copy of this message
ID: 42967 Updated by: jani@php.net Reported By: big_chief at gmx dot de -Status: Open +Status: Bogus -Bug Type: Mail related +Bug Type: IMAP related Operating System: Unix PHP Version: 5.2.4 New Comment: ext/imap is meant for reading mails using IMAP. IMAP isn't used for sending emails, that's what SMTP is for. imap_mail() is just a nice wrapper which uses the c-client functions to compose the mail to be send. Previous Comments: ------------------------------------------------------------------------ [2007-10-15 08:25:03] big_chief at gmx dot de Description: ------------ The function imap_mail() does not use imap on Unix systems. Instead, it searches for the local sendmail executable, ignoring any connection made by imap_open(). That way, it is impossible to send email e.g. - from an LAMP-only server without a local sendmail/exim/postfix - using alternative usernames/mailservers thus making the IMAP functionality quite senseless. Extraction of source code responsible for the bug: ext/imap/imap_mail.c, function _php_imap_mail, lines 3497-3522 #ifdef PHP_WIN32 [..] #else if (!INI_STR("sendmail_path")) { return 0; } sendmail = popen(INI_STR("sendmail_path"), "w"); if (sendmail) { [..] #endif Another bug here is that rpath variables is re-written as "From:", ignoring the additional_header variable that may contain "From: xyz..." also. Reproduce code: --------------- <?php // send email via imap imap_open($mailbox, $username, $password); imap_mail($target, $subject, $body); imap_close(); ?> Expected result: ---------------- Get an email from $username. Actual result: -------------- Get an email from the local (Apache) account running PHP. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42967&edit=1

« previous php.bugs (#118538) next »