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\"<me@example.com>\n";
	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
	mail('george@visualrealityink.com', 'Email with attachment from PHP', $headers, $message);

Link to comment
Share on other sites

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:

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.