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