php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42967 imap_mail() does not use imap on Unix
Submitted: 2007-10-15 08:25 UTC Modified: 2007-10-15 09:58 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: big_chief at gmx dot de Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.2.4 OS: Unix
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: big_chief at gmx dot de
New email:
PHP Version: OS:

 

 [2007-10-15 08:25 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-15 09:58 UTC] jani@php.net
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. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 19:01:31 2025 UTC