Re: mail() why not have attachments built in?

From: Date: Sat, 29 Mar 2014 14:15:23 +0000
Subject: Re: mail() why not have attachments built in?
References: 1  Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-18642@lists.php.net to get a copy of this message
it is so frustrating trying to find a way to send attachments. Why does mail() not have this built in? Can this be done? if so why has it not been? will this be done? it would make things so much easier if it was. If im voicing this to the wrong person please point me in the right direction? Thank You, Ryan Palmer
Firstly, wrong list. php.webmaster is place for discussions about PHP.net itself. You should move to php.general for such question. I think that we should make it more clear, because you are not first person doing this mistake. Back to your question. PHP allows you to specify any email headers you want, including attachments. This way is more flexible and makes this function more powerfull. If you want to simplify adding attachments, just write a wrapper or use existing one. There are already many scripts making mail()'s use easier, in example PHPMailer, Zend's Mail component or SwiftMailer. There are also examples in manual showing how to attach a file in "plain" PHP. Built-in functions are designed to be universal and flexible and this is the reason. Cheers, Maciej Sobaczewski.

« previous php.webmaster (#18642) next »