Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:10:07+00:00 2026-06-13T07:10:07+00:00

I’m trying to get ’email message’ from any Email Service Provider, like: yahoo, Gmail,

  • 0

I’m trying to get ’email message’ from any Email Service Provider, like: yahoo, Gmail, Hotmail. But I can’t get it. It’s show error message.

Following is my php script..

<?php

if( $mbox = imap_open("{yoursitename.com:110/pop3/notls}INBOX", "username of mailbox", 
"password of mailbox")){
$path = "set path here for where the attachments are store";
$check = imap_mailboxmsginfo($mbox);     
function getmsg($mbox,$mid) {   
    global $charset,$htmlmsg,$plainmsg,$attachments,$from,$to,$subj,$timages,$path;
    $htmlmsg = $plainmsg = $charset = '';
    $attachments = array();
    // HEADER
    $h = imap_headerinfo($mbox,$mid);
    // add code here to get date, from, to, cc, subject...
    $date = $h->date;
    $from = $h->fromaddress;
    $to = $h->toaddress;
      $subj = htmlspecialchars($h->Subject);
    // BODY
    $s = imap_fetchstructure($mbox,$mid);
    if (!$s->parts)  // simple
    getpart($mbox,$mid,$s,0);  // pass 0 as part-number
    else {  // multipart: cycle through each part
    foreach ($s->parts as $partno0=>$p)
      getpart($mbox,$mid,$p,$partno0+1);
    }
}

function getpart($mbox,$mid,$p,$partno) {
    // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
    global 
 $htmlmsg,$plainmsg,$charset,$attachments,$partid,$last_mail_id,$patterns,$pic,
 $newstr,$c,$ok,$timages,$subj,$path;
    $patterns = array();
    $pic =  array();
    $image=array();
    $data = ($partno) ? imap_fetchbody($mbox,$mid,$partno) : imap_body($mbox,$mid);    
// simple
    if ($p->encoding==4)
    $data = quoted_printable_decode($data);
    else if ($p->encoding==3)
    $data = base64_decode($data);
    // PARAMETERS    // get all parameters, like charset, filenames of attachments, 
etc.
    $params = array();
    if ($p->parameters)
    foreach ($p->parameters as $x)
        $params[strtolower($x->attribute)] = $x->value;
    if ($p->dparameters)
    foreach ($p->dparameters as $x)
        $params[strtolower($x->attribute)] = $x->value;

    // ATTACHMENT    // Any part with a filename is an attachment,
    // so an attached text file (type 0) is not mistaken as the message.
    if ($params['filename'] || $params['name']) {
    $partid = htmlentities($p->id,ENT_QUOTES);

       // filename may be given as 'Filename' or 'Name' or both
    $filename = ($params['filename'])? $params['filename'] : $params['name'];
    // filename may be encoded, so see imap_mime_header_decode()
     $attachments[$filename] = $data;  // this is a problem if two files have same name
    //store id and filename in array
    $image[$key] = $filename;

    }
    //save the attachments in the directory
    foreach( $attachments as $key => $val){
      $fname = $key;
      $fp = fopen("$path/$fname","w");
      fwrite($fp, $val);
      fclose($fp);
    }
        // TEXT
        if ($p->type==0 && $data) {
        // Messages may be split in different parts because of inline attachments,   
// so append parts together with blank row.
        if (strtolower($p->subtype)=='plain')
            $plainmsg .= trim($data)."\n\n";
        else
            //preg_match_all('/<img[^>]+>/i',$data, $result);
            $htmlmsg .= $data."<br><br>";
            $charset = $params['charset'];  // assume all parts are same charset
        }

    // There are no PHP functions to parse embedded messages, so this just appends the 
raw source to the main message.
    else if ($p->type==2 && $data) {
    $plainmsg .= $data."\n\n";
    }
    // SUBPART RECURSION
    if ($p->parts) {
    foreach ($p->parts as $partno0=>$p2)
        getpart($mbox,$mid,$p2,$partno.'.'.($partno0+1));  // 1.2, 1.2.1, etc.
    }
}

$attachments = array();
$num_msg = imap_num_msg($mbox);
if($num_msg>0) {
    getmsg($mbox,1);
}else {
     echo "Sorry!...No Messages in MailBox...<br>";
}

//imap_delete and imap_expunge are used to delete the mail after fetching....Uncomment 
it if you want to delete the mail from mailbox
//imap_delete($mbox,1); 
//imap_expunge($mbox);
imap_close($mbox);


}else { exit ("Can't connect: " . imap_last_error() ."\n");  echo "FAIL!\n";  };


?>

error message:

Warning: imap_open() [function.imap-open]: Couldn't open stream {yahoo.com:110/pop3
/notls}INBOX in D:\xampp server\xampp\htdocs\practice\php\email.php on line 2


Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp server\xampp
\htdocs\practice\php\email.php on line 2


Notice: Unknown: Can't connect to yahoo.com,110: Timed out (errflg=1) in Unknown on 
line 0

Notice: Unknown: Can't connect to yahoo.com,110: Timed out (errflg=1) in Unknown on 
line 0


Notice: Unknown: Can't connect to yahoo.com,110: Timed out (errflg=2) in Unknown on line 0

Can anyone fix it?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:10:08+00:00Added an answer on June 13, 2026 at 7:10 am

    As arkascha said, yahoo.com doesn’t listen on port 110.

    Yahoo’s POP3 server is pop.mail.yahoo.com on port 110 (or 995 with SSL) as stated in this Yahoo help article

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.