JavaScript Editor Javascript validator     Web page editor 


Mail_Mime::addAttachment() -- add attachment


require_once 'Mail/mime.php';

boolean addAttachment (string $file, string [$c_type = 'application/octet-stream'], string [$name = ''], boolean [$isfile = TRUE], string [$encoding = 'base64'])


Adds an attachment to a message.


Return value

boolean - Returns TRUE on success, PEAR_Error on failure.


Table 52-1. Possible PEAR_Error values

Error codeError messageReasonSolution
NULL "File is not readable file_name" The file was not found or the script has not enough rights to access the file. Check the file name and path. Check user and file permissions.
NULL "Could not open file_name" The file is already opened and exclusivly locked by another application. In the most cases a program opens the file for writing. addAttachment() does no file locking, so this problem is not caused by competitive callings of this function.


This function can not be called statically.

JavaScript Editor Javascript validator     Web page editor