niche Posted April 7, 2012 Share Posted April 7, 2012 how do I send an email with an attachment called test.png? I don' understand the ref at http://php.net/manua...ction.mail.php. Script so far: <?php$from = "info@lin.com";$to = "nihe@neb.rr.com";$subject = "Test";$message = "1234567890";$headers = "From: $from\r\n";$headers .= "Content-type: text/html\r\n";mail($to, $subject, $message, $headers);?> Link to comment Share on other sites More sharing options...
birbal Posted April 9, 2012 Share Posted April 9, 2012 you will need to send appropiate header for that file type. and after that you will need to parse the file and encode it in base64 delimiting by new line character as it does not exceed 70 characters. mail server are tend to pass ascii characters so you will need to base64 convert binary file when you will send.if you need to send it as attatchment with text or other file type you will need to set its header multipart/mixeda good example is herehttp://au.php.net/manual/en/function.mail.php#105661 Link to comment Share on other sites More sharing options...
justsomeguy Posted April 9, 2012 Share Posted April 9, 2012 It's common to use the Pear Mail package when sending complex or multi-part emails. Link to comment Share on other sites More sharing options...
niche Posted April 11, 2012 Author Share Posted April 11, 2012 thanks for your help birbal & justsomeguy. I'll look at the PEAR solution as soon as I can. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.