okej jag gjorde det nu och jag får fortaradne detta meddelande upp:
OK
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Min kod jag kör ser ut så här:
<?php //require 'init.php';
ob_start();
require('fpdf.php');
require 'PDF.php';
require('mailFunc.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GAL</title>
<link href="css/demo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$srv = 'xxx';
$user = 'xxx;
$pass = 'xxx;
$pfdRootDir = 'pdf';
$pdfd = scandir($pfdRootDir);
unset($pdfd[0],$pdfd[1]);
$conn = imap_open($srv, $user, $pass);
$boxes = imap_getmailboxes($conn, $srv, '*');
if (is_array($boxes)) {
foreach ($boxes as $key => $val) {
$nc = imap_open($val->name, $user, $pass);
$name = utf8_encode(mb_convert_encoding( $val->name, "ISO_8859-1", "UTF7-IMAP"));
$name = str_replace("å","a",$name);
$name = str_replace("ä","a",$name);
$name = str_replace("ö","o",$name);
$name = str_replace("Å","A",$name);
$name = str_replace("Ä","A",$name);
$name = str_replace("Ö","O",$name);
$name = end(explode('}', $name));
$name = strtolower($name);
$check = explode('/', $name);
if(in_array('loggbok', $check)){
$emails = imap_search($nc,'ALL');
if($emails){
// echo '<b>('.count($emails).') Mails ( '.$val->name.' )</b><br/>';
rsort($emails);
if(in_array($check[1], $pdfd)){
//echo "Map exist<br/>";
}else{
mkdir($pfdRootDir.'/'.$check[1]);
//echo "Map Created<br/>";
}
$name = preg_replace('/\s+/', '', $check[2]);
$pdfDir = $pfdRootDir.'/'.$check[1];
if (file_exists($pdfDir.'/'. $name.'-V1.pdf')) {
$VerNr = 1;
while(file_exists($pdfDir.'/'. $name.'-V'.$VerNr.'.pdf')){
$VerNr++;
}
$pdfFullPath = $pdfDir.'/'.$name.'-V'.$VerNr.'.pdf';
}else{
$pdfFullPath = $pdfDir.'/'.$name.'-V1.pdf';
}
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
foreach ($emails as $email_id) {
$head = getHeaders($nc, $email_id); // Get Header Info Return Array Of Headers **Key Are (subject,to,toOth,toNameOth,from,fromName)
$pdf->Cell(0,5,'Subjects :: '.utf8_encode(mb_convert_encoding($head['subject'], "ISO_8859-1", "UTF7-IMAP")),0,1);
$pdf->Cell(0,5,'TO :: '.$head['to'],0,1);
$pdf->Cell(0,5,'To Other :: '.$head['toOth'],0,1);
$pdf->Cell(0,5,'ToName Other :: '.$head['toNameOth'],0,1);
$pdf->Cell(0,5,'From :: '.$head['from'],0,1);
$pdf->Cell(0,5,'FromName :: '.$head['fromName'],0,1);
$pdf->Ln(5);
$pdf->Cell(0,5,'Message:',0,1);
$pdf->WriteHTML(getBody($nc, $email_id));
$str = GetAttech($nc, $email_id,"./"); // Get attached File from Mail Return name of file in comma separated string args. (mailid, Path to store file)
$ar = explode(",",$str);
if(count($ar)){
foreach($ar as $key=>$value){
$pdf->Ln(5);
$pdf->Cell(0,5,'Bilagor:',0,1);
$value = str_replace(" ","-",$value);
$ext = strtoupper(end(explode('.',$value)));
($value=="")?"":$URL = 'http://mailtest.robinkardell.com/se/'.$value;
if($ext == 'JPEG' ||$ext == 'JPG'|| $ext == 'PNG' || $ext == 'GIF'){
($value=="")?"":$pdf->Image($URL,null,null,null,null,$ext);
($value=="")?"":$pdf->Cell(0,5,'Atteched File :: '.$value,0,1);
}else{
($value=="")?"":$pdf->Cell(0,5,'Atteched File :: '.$value,0,1);
}
}
$pdf->Cell(0,5,'------------------------------------------',0,1);
}
}
$pdf->Output($pdfFullPath, 'F');
}
}
ob_flush();
imap_close($nc);
}
}
imap_close($conn);
?>
</body>
</html>