Mail_Mime::addAttachment()

Mail_Mime::addAttachment() – add attachment

Synopsis

require_once 'Mail/mime.php';

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

Description

Adds an attachment to a message.

Parameter

  • string $file - The file name or the data itself

  • string $c_type - The content type of the image or file.

  • string $name - The suggested file name for the data. Only used, if $file contains data.

  • boolean $isfile - Whether $file is a file name or not.

  • string $encoding - Type of transfer encoding to use for the file data. Defaults is "base64". For text based files (eg. scripts/html etc.) this could be given as "quoted-printable".

Return value

boolean - Returns TRUE on success, PEAR_Error on failure.

Throws

Possible PEAR_Error values
Error code Error message Reason Solution
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.

Note

This function can not be called statically.

creates a new instance (Previous) add image to message (Next)
Last updated: Sun, 19 Dec 2010 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

Note by: lokesh_java@rediffmail.com
while using addAttachment(), it does not encrypt the attache data.
i have provided the whole content of the attache file.
please do let me know how to resolve it.