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 8348745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:47:00+00:00 2026-06-09T07:47:00+00:00

I currently use the SwiftMailer library to send email, but unfortunately it’s only for

  • 0

I currently use the SwiftMailer library to send email, but unfortunately it’s only for sending, not receiving. I’m wondering… is there a similar library to connect via IMAP to an email account and read the email (IE give me the ability to loop through email). I’m aware there are a set of PHP IMAP functions located here: https://www.php.net/manual/en/book.imap.php

But my question is, does anybody know of an alternative libarary or IMAP wrapper class for receiving/viewing all your emails?

I seriously couldn’t find anything, thanks in advance.

  • 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-09T07:47:01+00:00Added an answer on June 9, 2026 at 7:47 am

    see below ur:–

    http://www.php.net/mailparse

    http://garrettstjohn.com/entry/reading-emails-with-php/

    or try it:-

    Reading Emails with PHP

    <?php
    
        class Email_reader {
    
            // imap server connection
            public $conn;
    
            // inbox storage and inbox message count
            private $inbox;
            private $msg_cnt;
    
            // email login credentials
            private $server = 'yourserver.com';
            private $user   = 'email@yourserver.com';
            private $pass   = 'yourpassword';
            private $port   = 143; // adjust according to server settings
    
            // connect to the server and get the inbox emails
            function __construct() {
                $this->connect();
                $this->inbox();
            }
    
            // close the server connection
            function close() {
                $this->inbox = array();
                $this->msg_cnt = 0;
    
                imap_close($this->conn);
            }
    
            // open the server connection
            // the imap_open function parameters will need to be changed for the particular server
            // these are laid out to connect to a Dreamhost IMAP server
            function connect() {
                $this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass);
            }
    
            // move the message to a new folder
            function move($msg_index, $folder='INBOX.Processed') {
                // move on server
                imap_mail_move($this->conn, $msg_index, $folder);
                imap_expunge($this->conn);
    
                // re-read the inbox
                $this->inbox();
            }
    
            // get a specific message (1 = first email, 2 = second email, etc.)
            function get($msg_index=NULL) {
                if (count($this->inbox) <= 0) {
                    return array();
                }
                elseif ( ! is_null($msg_index) && isset($this->inbox[$msg_index])) {
                    return $this->inbox[$msg_index];
                }
    
                return $this->inbox[0];
            }
    
            // read the inbox
            function inbox() {
                $this->msg_cnt = imap_num_msg($this->conn);
    
                $in = array();
                for($i = 1; $i <= $this->msg_cnt; $i++) {
                    $in[] = array(
                        'index'     => $i,
                        'header'    => imap_headerinfo($this->conn, $i),
                        'body'      => imap_body($this->conn, $i),
                        'structure' => imap_fetchstructure($this->conn, $i)
                    );
                }
    
                $this->inbox = $in;
            }
    
        }
    
        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send out batch mails using SwiftMailer but just wondering what the
I currently use: BufferedReader input = new BufferedReader(new FileReader(filename)); Is there a faster way?
I'm currently using SwiftMailer to send out emails to several users (up to 50).
I currently use Authlogic in a web-app to handle user authentication, but have now
I currently use my iPhone 3G for testing my apps, but I am thinking
I currently use a simple winsock solution (WSAStartup, socket, connect, send, recv, closesocket) for
I currently use the 3-layer architecutre (DAL, BLL, Presentation Layer). I am wondering how
We currently use clearcase on a project, and there is an HTML file that
I currently use Chrome/Firefox for my web development. Is there a plugin, or am
We currently use VSS for source control management, but we want to convert to

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.