Znalazłem klase z obsługą pop3 itd. Chciałem juz od dawna czytac maile z załącznikiem w php i nietylko. Pech sprawił ze w delphi ze tak powiem cały gotowiec znaleziony nie ruszył i nie analizowalem nawet bo mi sie wywala komp:( Szukalem dalej i mam klase oraz skrypt czytający. Problem w tym ze po wpisaniu nazwy serwera oraz pozostałych danych, pokazuje mi błąd.
Warning: imap_open() [function.imap-open]: Couldn't open stream {poczta.wp.pl:110/pop3} in /home.10.4/fuwclxyy/www/gg/attachmentread.class.php on line 50
can't connect: Connection failed to poczta.wp.pl,110: Connection refused
read.php
<?
require_once("attachmentread.class.php");
$host="{poczta.wp.pl:110/pop3}"; // pop3host
$login="login"; //pop3 login
$password="bleble"; //pop3 password
$savedirpath="" ; // attachement will save in same directory where scripts run othrwise give abs path
$jk=new readattachment(); // Creating instance of class####
$jk->getdata($host,$login,$password,$savedirpath); // calling member function
?>
oraz klasa
<?
######################################
#Coded By Jijo Last Update Date[Jan/19/06]
#####################################
##########################################################
###################### Class readattachment ###############
class readattachment
{
function getdecodevalue($message,$coding)
{
if ($coding == 0)
{
$message = imap_8bit($message);
}
elseif ($coding == 1)
{
$message = imap_8bit($message);
}
elseif ($coding == 2)
{
$message = imap_binary($message);
}
elseif ($coding == 3)
{
$message=imap_base64($message);
}
elseif ($coding == 4)
{
$message = imap_qprint($message);
}
elseif ($coding == 5)
{
$message = imap_base64($message);
}
return $message;
}
function getdata($host,$login,$password,$savedirpath)
{
$mbox = imap_open ($host, $login, $password) or die("can't connect: " . imap_last_error());
$message = array();
$message["attachment"]["type"][0] = "text";
$message["attachment"]["type"][1] = "multipart";
$message["attachment"]["type"][2] = "message";
$message["attachment"]["type"][3] = "application";
$message["attachment"]["type"][4] = "audio";
$message["attachment"]["type"][5] = "image";
$message["attachment"]["type"][6] = "video";
$message["attachment"]["type"][7] = "other";
for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++)
{
$structure = imap_fetchstructure($mbox, $jk , FT_UID);
$parts = $structure->parts;
$fpos=2;
for($i = 1; $i < count($parts); $i++)
{
$message["pid"][$i] = ($i);
$part = $parts[$i];
if($part->disposition == "ATTACHMENT")
{
$message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
$message["subtype"][$i] = strtolower($part->subtype);
$ext=$part->subtype;
$params = $part->dparameters;
$filename=$part->dparameters[0]->value;
$mege="";
$data="";
$mege = imap_fetchbody($mbox,$jk,$fpos);
$filename="$filename";
$fp=fopen($filename,w);
$data=$this->getdecodevalue($mege,$part->type);
fputs($fp,$data);
fclose($fp);
$fpos+=1;
}
}
//imap_delete tags a message for deletion
//imap_delete($mbox,$jk);
}
// imap_expunge deletes all tagged messages
//imap_expunge($mbox);
imap_close($mbox);
}
}
?>
Zmieniając port z 110 na 80 długo przymielił i tez nic. Teraz powstaje pytanie gdzie jest problem. Czy to sprawa php 5 ? Wersji czy jak?
Bardzo prosze o pomoc, nieźle sie trzeba namęczyc zeby miec taką przydatną rzecz a nigdzie nie znalazłem w pełni działającego tutoriala lub opisu krok po kroku po POlsku.
Manual nie wiele mi dał gdyz nie jestem dobry w php. Bardzo prosze o jakies wskazówki, będę bardzo wdzieczny i jesli moge w czyms pomoc w innych tematach bardzo chetnie sie odwdzięcze.
(3d, 2d, animacja, Flash, trackery, edycja video, muzyka......)
Pozdrawiam
1024
po zmianach działa, pobiera załączniki ale....No własnie ale jak leci a jak teraz pobrac np temat albo z góry ustaloną wiadomosc o danym temacie
