PHP: mailattach

(PHP 4, PHP 5) mailattach – A function to include file attachments to emails via PHP.


bool mailattach(string $to, $subject, $message, $headers[, string $additional[, string $attachment]])



Email Address the message/file is to be attached.


Email Subject.


Email Body Text


Email headers, from, reply to etc.


Additional parameters.


File Location of the attachment to be sent.

Return Values

Returns true on send
Returns false on error
NOTE: This function hasn’t been tested for large attachments.



View / Download Raw Changelog

Version 2.0.0

  • Moved the input parameters around to be compatible with the default mail() command.
  • Fixed issues with bad code.
  • More valid phpdoc header.
  • Concatenated some lines and removed uneeded code.

Version 1.0.0

  • Initial Release.

Info and Downloads


OS: Any
Dependencies: PHP 4, PHP 5
Optional: None
Network: Any
License: GNU GPL v3

Previous Versions:

Version 1.0.0