내 godaddy 공유 hosing 서비스는 PHP 용 IMAP 확장을 활성화하지 않습니다. 그래서 저는 피클에 있습니다 :php imap 확장 프로그램에 대한 대안이 있습니까
PHP의 IMAP 기능을 대체 할 수있는 PHP 기능이 있습니까?
다음Fatal error: Call to undefined function imap_last_error()
내가 함께하는 데 문제가 샘플 코드입니다 : 여기
는 오류가 사전에$mbox = imap_open ('{'.$email_host.':'.$email_port.'/pop3/novalidate-cert}INBOX', $email_username, $email_password) or die(imap_last_error());
if(!$mbox){
// send email letting them know bounce checking failed?
// meh. later.
echo 'Failed to connect when checking bounces.';
}else{
$MC = imap_check($mbox);
$result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0);
foreach ($result as $overview) {
$this_subject = (string)$overview->subject;
//echo "#{$overview->msgno} ({$overview->date}) - From: {$overview->from} <br> {$this_subject} <br>\n";
$tmp_file = tempnam('/tmp/','newsletter_bounce');
// TODO - tmp files for windows hosting.
imap_savebody ($mbox, $tmp_file, $overview->msgno);
$body = file_get_contents($tmp_file);
if(preg_match('/Message-ID:\s*<?Newsletter-(\d+)-(\d+)-([A-Fa-f0-9]{32})/imsU',$body,$matches)){
// we have a newsletter message id, check the hash and mark a bounce.
//"message_id" => "Newsletter-$send_id-$member_id-".md5("bounce check for $member_id in send $send_id"),
$send_id = (int)$matches[1];
$member_id = (int)$matches[2];
$provided_hash = trim($matches[3]);
$real_hash = md5("bounce check for $member_id in send $send_id");
if($provided_hash == $real_hash){
$sql = "UPDATE "._DB_PREFIX."newsletter_member SET `status` = 4, bounce_time = '".time()."' WHERE `member_id` = '".$member_id."' AND send_id = '".$send_id."' AND `status` = 3 LIMIT 1";
query($sql);
imap_delete($mbox, $overview->msgno);
}else{
// bad hash, report.
}
}
unlink($tmp_file);
}
imap_expunge($mbox);
imap_close($mbox);
}
}
감사합니다!
IMAP는 오랫동안 내장되어있어 아무도 외부 클래스를 작성하지 않은 것 같습니다. 솔직히, 그것은'imap_ *'함수를 허용하지 않는 거시기 이동의 일종이며,''fsockopen() ''을 허용하면 의심 스럽습니다. 아마 호스트를 변경해야합니다. 이 문제를 해결하기 위해 GoDaddy의 호스팅에 대해 아직 아무 것도 듣지 못했습니다. – Sammitch