Zum Inhalt springen

da_MP

Mitglieder
  • Gesamte Inhalte

    2
  • Benutzer seit

  • Letzter Besuch

  1. ja mach ich ja aber ich wollte von euch wissen ob des so mit dem Script geht oder nicht und wenn es nicht geht will ich wissen wie es geht bzw. was falsch ist
  2. Hallo, ich hab ein kleines Problem ich hab mir in den letzten tagen ein Script zusammen gebastelt das e-Mails von einen Pop3 Server läd und an eine Verteiler liste weiter leitet. Das Problem dabei ist dass ich es einfach nicht hin bekomme das die Anhänge weitergeleitet werden. Könnte mir da vielleicht einer helfen da ich selbst jetzt nicht so wirklich der php Checker bin. Hier mal das Grund Script, das Test Script für den Anhang ist weiter unten und danke schon mal im voraus // Server $host = "Server"; // Port bei POP3 110 und bei IMAP 143 $port = "110"; // POP3 oder IMAP Server $Server = "POP3"; // Benutzername $user_id = ""; // Passwort $password = "Passwort"; // Empfänger $datei = "adressen.txt"; //------------------------------------------------------------------------------- function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART", "MESSAGE", "APPLICATION", "AUDIO", "IMAGE", "VIDEO", "OTHER"); if($structure->subtype) { return $primary_mime_type[(int) $structure->type] . '/' . $structure->subtype; } return "TEXT/PLAIN"; } function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) { if(!$structure) { $structure = imap_fetchstructure($stream, $msg_number); } if($structure) { if($mime_type == get_mime_type($structure)) { if(!$part_number) { $part_number = "1"; } $text = imap_fetchbody($stream, $msg_number, $part_number); if($structure->encoding == 3) { return imap_base64($text); } else if($structure->encoding == 4) { return imap_qprint($text); } else { return $text; } } if($structure->type == 1) { /* multipart */ while(list($index, $sub_structure) = each($structure->parts)) { if($part_number) { $prefix = $part_number . '.'; } $data = get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1)); if($data) { return $data; } } } } return false; } $open = imap_open("{".$host.":".$port."/".$Server."}", "$user_id", "$password"); $check = imap_status($open, "{".$host.":".$port."/".$Server."}INBOX", SA_MESSAGES); if($check->messages >= "1") { for($i = 1; $i < $check->messages +1; $i++){ $head = imap_headerinfo ($open ,$i); $from = $head->fromaddress; $subject = $head->subject; $structure = imap_fetchstructure($open,$i); $type = $structure->type; if($type == 0) { $data = get_part($open, $i, "TEXT/PLAIN"); } else if($type == 1) { $data = get_part($open, $i, "TEXT/HTML"); } $message = $data; $fp = fopen($datei,"r"); $adressen = fgets($fp); fclose($fp); $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $header .= 'From: ' . $from . "\r\n"; $header .= 'Bcc: ' . $adressen . "\r\n"; mail ("Verteiler",$subject,$message,$header)[/PHP] und hier das was eig. dafür sorgen soll das der Anhang weitergeleitet wird weis aber eben nicht ob das so funktionieren kann [PHP]function check($data1) { if($data1->parts[1]->disposition == ATTACHMENT) return true; else return false; } $anhang = imap_fetchstructure($open,$i, 2); $file = "1"; if(check($anhang) == true) { $att[$i] = imap_bodystruct($open,$i, 2); $strFileName = $att[$i]->parameters[0]->value; $strFileType = strrev(substr(strrev($strFileName),0,3)); $fileContent = imap_fetchbody($open,$i,$file+2); $Dateiname = "".$strFileName."."$strFileType""; if ($strFileType == ".asf") $ContentType = "video/x-ms-asf"; if ($strFileType == ".avi") $ContentType = "video/avi"; if ($strFileType == ".doc") $ContentType = "application/msword"; if ($strFileType == ".zip") $ContentType = "application/zip"; if ($strFileType == ".xls") $ContentType = "application/vnd.ms-excel"; if ($strFileType == ".gif") $ContentType = "image/gif"; if ($strFileType == ".jpg" || $strFileType == "jpeg") $ContentType = "image/jpeg"; if ($strFileType == ".wav") $ContentType = "audio/wav"; if ($strFileType == ".mp3") $ContentType = "audio/mpeg3"; if ($strFileType == ".mpg" || $strFileType == "mpeg") $ContentType = "video/mpeg"; if ($strFileType == ".rtf") $ContentType = "application/rtf"; if ($strFileType == ".htm" || $strFileType == "html") $ContentType = "text/html"; if ($strFileType == ".xml") $ContentType = "text/xml"; if ($strFileType == ".xsl") $ContentType = "text/xsl"; if ($strFileType == ".css") $ContentType = "text/css"; if ($strFileType == ".php") $ContentType = "text/php"; if ($strFileType == ".asp") $ContentType = "text/asp"; if ($strFileType == ".pdf") $ContentType = "application/pdf"; } $Trenner = md5(uniqid(time())); $header .= "--$Trenner"; $header .= "\n"; $header .= "Content-Type: $ContentType; name=$Dateiname"; $header .= "\n"; $header .= "Content-Transfer-Encoding: base64"; $header .= "\n"; $header .= "Content-Disposition: attachment; filename=$Dateiname"; $header .= "\n\n"; $header .= "$fileContent"; $header .= "\n"; $header .= "--$Trenner--";

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...