Jump to content

mail Help needed


phpretard

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.