TGWSE_GY Posted March 26, 2011 Share Posted March 26, 2011 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 $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); Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/ Share on other sites More sharing options...
Skewled Posted March 26, 2011 Share Posted March 26, 2011 Was $message defined before appending more information to it? All i see is $message .= Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192594 Share on other sites More sharing options...
TGWSE_GY Posted March 26, 2011 Author Share Posted March 26, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192597 Share on other sites More sharing options...
TGWSE_GY Posted March 26, 2011 Author Share Posted March 26, 2011 Am I not putting the headers together right, or the message? Or is it the way its being sent to mail()? Any help would be greatly appreciated. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192608 Share on other sites More sharing options...
PFMaBiSmAd Posted March 26, 2011 Share Posted March 26, 2011 Listing of the mail() parameters - Description bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192610 Share on other sites More sharing options...
TGWSE_GY Posted March 26, 2011 Author Share Posted March 26, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192613 Share on other sites More sharing options...
mattal999 Posted March 26, 2011 Share Posted March 26, 2011 That's because you don't have a variable called $body. It's $message. mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192623 Share on other sites More sharing options...
Skewled Posted March 26, 2011 Share Posted March 26, 2011 On my phone atm, glad to know they were defined. I can't see the full code from my phone go figure. I will check back when I get home. Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192633 Share on other sites More sharing options...
TGWSE_GY Posted March 26, 2011 Author Share Posted March 26, 2011 Ok for security and other purposes I went to just phpMailer! its more friendly as far as attachments go plus more secure I think Thanks for all the help guys!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/231789-issues-with-sending-email-through-php-mail-function-message-text-not-in-email/#findComment-1192667 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.