php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48826 Add attachment support to mail()
Submitted: 2009-07-07 04:30 UTC Modified: 2018-03-13 21:45 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: php at richardneill dot org Assigned:
Status: Suspended Package: Mail related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-07-07 04:30 UTC] php at richardneill dot org
Description:
------------
It would be a really nice if mail() supported an extra parameter for 
attachments. Perhaps an array containing the filenames (and whose 
keys, if present, would be the name of the attachments).

(I know there are ways of doing this by installing pear classes, but 
that isn't always an option. And it's awkward to do it by hand).

Given that mail() is already rather overloaded, it might be worth 
adding another function, say mail_attach() to do it.



Reproduce code:
---------------
Current alternative:

$cmd = "echo '$BODY_TEXT'  | mutt -s '$SUBJECT' -a '$filename_1' -a '$filename_2' '$email'";
exec ($cmd);

which is ugly, has external dependencies, only works on Linux, and will break in interesting ways if shell-quoting isn't corrected.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 16:13 UTC] jani@php.net
-Summary: wish: mail() to support attachments +Summary: Add attachment support to mail() -Package: Feature/Change Request +Package: Mail related -Operating System: Linux +Operating System: * -PHP Version: 6CVS-2009-07-07 (CVS) +PHP Version: *
 [2011-03-17 18:10 UTC] anrdaemon at freemail dot ru
"Given the fact it is already overloaded", it is better to cleanup and shape the code for a more robust and predictable functionality.
Not to bloat it unnecessarily.
 [2018-03-13 21:45 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2018-03-13 21:45 UTC] cmb@php.net
In my opinion, adding explicit multipart support to mail() is not
desirable, since there are already several existing userland
solutions.  So this feature request is controversial, and as such
would require the RFC process[1].  Anybody is welcome to start it!
For the time being, I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 10:01:25 2020 UTC