phpretard Posted March 1, 2009 Share Posted March 1, 2009 There are a couple of problems: 1. The pages stall excessively while running the script. 3. This send the attachment (doc) but rewrites the content. 2. If I send a pdf (with the appropriate headers) I get a corrupted pdf in my inbox Without the attach code it sends a perfect html email. NOTE: This is on a windows server. Cant anyone help me out with this? <?php $message = " <table border='0' width='750'> <tr> <td>TEST</td> </tr> </table> "; $filename = "TradeMark.doc"; $filetype = "application/doc"; $filecontents = file_get_contents($filename); $Name = "Senders Name"; $email = "from@my_site.com"; $recipient = "to@my_site.com"; $subject = "Subject for reviever"; $emailid=md5(time()); $headers = "From: ". $Name . " <" . $email . ">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed;"; $headers .= "boundary=$emailid\r\n--".$emailid."\r\n"; //$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"; $headers .= "Content-Type: text/html; charset=\"utf-8\"\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n".$message."\r\n--".$emailid."\r\n"; $headers .="Content-Type: ".$filetype."; name=\"".$filename."\"\r\n"; $headers .="Content-Transfer-Encoding: base64\r\n"; $headers .="Content-Disposition: attachment; filename=\"$filename\"\r\n\r\n".chunk_split(base64_encode($filecontents))."\r\n--".$emailid."--"; mail($recipient, $subject, $message, $headers); ?> I know about php mailer, and swift; but I really don't want the extensive coding for a simple task. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.