Autor Zpráva
teapack
Profil
Zdravím,
pokouším se rozchodit skript, který by měl poslat mail i s přílohami. Na localu funguje, ale na serveru (hosting.blueboard.cz) už ne. Místo příloh přijdou jen textové soubory (obsahující XHrXeW3hyfXF5QqnqRVV/A9xp...). Navíc před textem e-mailu je "Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 8bit".

Funkce:
function xmail($email_address,$email_from,$subject,$msg,$attach_filepath)
{
  $b = 0;
  $mail_attached = "";
  $boundary = md5(uniqid(time(),1))."_xmail";
  if (count($attach_filepath)>0)
  {
    for ($a=0;$a < count($attach_filepath);$a++) 
    {
      if ($fp = fopen($attach_filepath[$a],"rb"))
      {
        $file_name = basename($attach_filepath[$a]);
        $content[$b] = fread($fp,filesize($attach_filepath[$a]));
        $mail_attached .= "--".$boundary."\r\n".
          "Content-Type: image/jpeg; name=\"$file_name\"\r\n".
          "Content-Transfer-Encoding: base64\r\n".
          "Content-Disposition: inline; filename=\"$file_name\"\r\n\r\n".
          chunk_split(base64_encode($content[$b]))."\r\n";
        $b++;
        fclose($fp);
      }
    }
    $mail_attached .= "--".$boundary." \r\n";
    $add_header ="MIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"$boundary\"";
    $mail_content = "--".$boundary."\r\n".
      "Content-Type: text/plain; charset=windows-1250; format=flowed\r\n".
      "Content-Transfer-Encoding: 8bit\r\n\r\n".
      $msg."\r\n\r\n".$mail_attached;

    return mail($email_address,$subject,$mail_content,"From: ".$email_from."\r\n".$add_header);
  }
  else return mail($email_address,$subject,$msg,"From: ".$email_from);
}


Je chyba třeba v nastavení serveru? Nebo někde jinde?

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0