Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there an alternative to php imap extension
    text
    copied!<p>My godaddy shared hosing service will not enable the IMAP extension for PHP. So I am in a pickle:</p> <p>Is there a PHP function to replace the IMAP feature in PHP ?</p> <p>Here is the error: </p> <pre><code>Fatal error: Call to undefined function imap_last_error() </code></pre> <p>Here is the sample code that I am having problems with:</p> <pre><code>$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-&gt;Nmsgs}",0); foreach ($result as $overview) { $this_subject = (string)$overview-&gt;subject; //echo "#{$overview-&gt;msgno} ({$overview-&gt;date}) - From: {$overview-&gt;from} &lt;br&gt; {$this_subject} &lt;br&gt;\n"; $tmp_file = tempnam('/tmp/','newsletter_bounce'); // TODO - tmp files for windows hosting. imap_savebody ($mbox, $tmp_file, $overview-&gt;msgno); $body = file_get_contents($tmp_file); if(preg_match('/Message-ID:\s*&lt;?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" =&gt; "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-&gt;msgno); }else{ // bad hash, report. } } unlink($tmp_file); } imap_expunge($mbox); imap_close($mbox); } } </code></pre> <p>Thanks in advance!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload