Jump to content

Issues with sending email through PHP mail() function message text not in email


TGWSE_GY

Recommended Posts

Everything about the email is sending except the message text does anyone know what the issue could be?

 

here is the block of code that sends the email

Thanks in advance :D

$image = "http://www.visualrealityink.com/dev/clients/arzan/snell_form/images/email.png";
 	 echo "got to process form";
	$target_path = "upload/";                   
	$path = $target_path = $target_path . basename( $_FILES['file']['name']);                  
	$boundary = '-----=' . md5( uniqid ( rand() ) );

	$message .= "Content-Type: application/msword; name=\"my attachment\"\n";
	$message .= "Content-Transfer-Encoding: base64\n";
	$message .= "Content-Disposition: attachment; filename=\"$path\"\n\n";


	echo $path;
	$fp = fopen($path, 'r');
	do //we loop until there is no data left
	{
			$data = fread($fp, 8192);
			if (strlen($data) == 0) break;
			$content .= $data;
		  } while (true);
	$content_encode = chunk_split(base64_encode($content));
	$message .= $content_encode . "\n";
	$message .= "--" . $boundary . "\n";
	$message .= $image . "<br />" . $_POST['name'] . "submitted a resume on our website. Please review the applications and contact the candidate if their resume is a fit for any open opportunities with the company. <br><br> Thank you. <br><br> SEI Team";
	$headers  = "From: \"Me\"<[email protected]>\n";
	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
	mail('[email protected]', 'Email with attachment from PHP', $headers, $message);

Yes $message and $content are both called right before $image=........

I set $message = ""; and $content ="";

 

I am so confused at this point, doesn't make much sense that the body isn't getting delivered along with the message.

 

 

when I do

mail( $to, $subject, $body, $headers );

the message is never sent, this is per the instructions

Description

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

however when I run
mail( $to, $subject, $headers, $body );

the email is sent but the body of the message is blank.

 

Seems to be an odd trade off either the attachment gets delivered with no body text, or the email doesn't get delivered at all. Anyone ever had similar issues? Or know what could be causing it to go haywhire?

 

Thanks again

:confused:

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.