logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Sisimai::Mail::Maildir - Mailbox reader

Author

       azumakuniyuki

Class Methods

"new(pathtoMaildir/)"
       new() method is a constructor of "Sisimai::Mail::Maildir"

           my $maildir = Sisimai::Mail::Maildir->new('/home/neko/Maildir/new');

Description

       "Sisimai::Mail::Maildir" is a reader for getting contents of each email in the Maildir/ directory.

Instance Methods

"dir()"
       dir() method returns the path to Maildir/

           print $maildir->dir;   # /home/neko/Maildir/new/

   "path()"
       path() method returns the path to each email in Maildir/

           print $maildir->path;   # /home/neko/Maildir/new/1.eml

   "file()"
       file() method returns the current file name of the Maildir.

           print $maildir->file;

   "size()"
       size() method returns the amount of email size which has been read

           print $maildir->size;

   "offset()"
       offset() method returns the number of emails which have been read in the Maildir/

           $maildir->offset;   # 2

   "handle()"
       handle() meethod returns file handle object "IO::Dir" of the Maildir.

           $maildir->handle->close;

   "read()"
       read() method works as an iterator for reading each email in the Maildir.

           my $maildir = Sisimai::Mail->new('/home/neko/Maildir/new');
           while( my $r = $mailbox->read ) {
               print $r;   # print each email in /home/neko/Maildir/new
           }

License

       This software is distributed under The BSD 2-Clause License.

perl v5.40.1                                       2025-04-12                        Sisimai::Mail::Maildir(3pm)

Name

       Sisimai::Mail::Maildir - Mailbox reader

Synopsis

           use Sisimai::Mail::Maildir;
           my $maildir = Sisimai::Mail::Maildir->new('/home/neko/Maildir/new');
           while( my $r = $maildir->read ) {
               print $r;   # print contents of the mail in the Maildir/
           }

See Also