Jump to content

Problem with attachment. Any Ideas?


brduran

Recommended Posts

If you know PHP, please have a look at the code below ... is regarding attachments, because it works without attachments.

 

I'm getting this error => Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent ..on line 651 which is the one before the end, it reads => mail($Recipient, $Subject, $Content, $Headers);

 

Since it doesn't look on our part we disabled it, bot we'll keep it on for a day or wo so you can see the error message yourself. There's got to be a way around, I just don't know how.

 

http://www.teknician.com/forms/employment/main.php

 

Any help appreciated. Thank you.

 

 

 

#==========================================================

# Put Header Information in Email

#==========================================================

 

$Headers .= "From: $SendFrom\n";

$Headers .= "Reply-to: $SendFrom\n";

$Headers .= "Return-Path: $SendFrom\n";

if ($CC)

$Headers .= "cc: $CC\n";

$Headers .= "X-Mailer: My PHP Mailer\n";

$Headers .= "MIME-Version: 1.0\n";

if ($AttachmentFields and ($ATTACH[0][0] or $ATTACH[1][0] or $ATTACH[2][0]))

  $Headers .= "Content-Type: multipart/mixed; charset=\"iso-8859-1\";\n\n";

 

if ($TextEmails == "1")

{

$Content .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";

$Content .= "Content-Transfer-Encoding: 8bit\n\n";

$Content .= $EMAIL['textemail']."\n\n";

}

if ($HtmlEmails == "1")

{

$Headers .= "Content-Type: text/html; charset=\"iso-8859-1\";\n\n";

$Content .= $EMAIL['htmlemail']."\n\n";

}

if ($AttachmentFields)

{

   for ($x=0;$x<count($ATTACH);$x++)

   {

        $TmpFile = "data/".$ATTACH[$x][0];

        @copy($ATTACH[$x][1],"$TmpFile");

        $fa = @fopen ($TmpFile,'r');

        $FileContent = @fread($fa,filesize($TmpFile));

        @fclose($fa);

        $FileContent = chunk_split(base64_encode($FileContent));

 

        $Content .= "Content-Type: application/octetstream;\n name=\"".$ATTACH[$x][0]."\"\n";

        $Content .= "Content-Transfer-Encoding: base64\n";

        $Content .= "Content-Disposition: attachment;\n filename=\"".$ATTACH[$x][0]."\"\n\n";

        $Content .= $FileContent."\n";

        @unlink($TmpFile);

   }

}

#==========================================================

# Send It Off

#==========================================================

mail($Recipient, $Subject, $Content, $Headers);

 

} // END OF ACTION

Link to comment
https://forums.phpfreaks.com/topic/101071-problem-with-attachment-any-ideas/
Share on other sites

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.