Tag Archives: MIME

PHP – Send Attachment with PHP mail()

Update @ 2014-03-10: If the following piece of code doesn’t work, you could try the comment written by karmaprod.

Update @ 2014-01-17: You may need to change the PHP_EOL setting in Windows environment as suggested by Rene.

Update @ 2015-02-13: Replace all “/r/n” to PHP_EOL as suggested by Rene and Tomas for windows environment and sending image attachment.

By default, the PHP mail() does not support sending email with attachment. In order to send an attachment, u can either use the PEAR package or PHPMailer. But in reality, the hosting server may not provide these kinds of third party libraries.
Continue reading PHP – Send Attachment with PHP mail()