Sisimai::Mail(3pm)

πŸ’Œ Sisimai::Mail(3pm) πŸ’Œ

User Contributed Perl Documentation ✨ welcome to the Sisimai::Mail situation bestie, this is the perl manual page and we're gonna read it together, no skimming, I promise πŸ’–


🌸 NAME 🌸

Sisimai::Mail</purgle> β€” handler of Mbox/Maildir for reading each mail. That's it, that's the whole job, she reads your mail files one email at a time and she does it flawlessly πŸ‘‘


✨ SYNOPSIS ✨

okay so here's how you actually use her, three whole vibes:

use Sisimai::Mail;
my $mailbox = Sisimai::Mail->new('/var/mail/root');
while( my $r = $mailbox->read ) {
    print $r;
}

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

my $mailtxt = 'From Mailer-Daemon ...';
my $mailobj = Sisimai::Mail->new(\$mailtxt);
while( my $r = $mailobj->read ) {
    print $r;
}

like. look at her go. mbox, Maildir, and even a raw string reference β€” she does not care, she serves πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Sisimai::Mail is a handler for reading a UNIX mbox, a Maildir, or any email message input from the STDIN variable. It's a wrapper class of the following child classes, which is very "I have a whole friend group and they all do their own thing" of her:

  • Sisimai::Mail::Mbox
  • Sisimai::Mail::Maildir
  • Sisimai::Mail::STDIN
  • Sisimai::Mail::Memory

she's basically the group chat admin of these four, no cap 🫢


🌟 CLASS METHODS 🌟

πŸ’« new(path to mbox|Maildir/)

so new() method is a constructor of Sisimai::Mail β€” it's giving "let me introduce you to my main character" energy ✨

my $mailbox = Sisimai::Mail->new('/var/mail/root');
my $maildir = Sisimai::Mail->new('/home/nyaa/Maildir/cur');
my $mailtxt = 'From Mailer-Daemon ...';
my $mailobj = Sisimai::Mail->new(\$mailtxt);

yup, three ways to summon her: a path to an mbox, a path to a Maildir, or a reference to a string of raw mail text πŸŽ€


πŸŽ€ INSTANCE METHODS πŸŽ€

πŸ’– path()

path() method returns the path to the mbox or the Maildir. she knows where she came from, iconic behavior honestly πŸ’…

print $mailbox->path;   # /var/mail/root

🌈 kind()

kind() method returns the name of the data type. a little vibe check for your mailbox πŸ¦‹

print $mailbox->kind;   # mailbox or maildir, stdin, or memory.

⭐ mail()

mail() method returns the Sisimai::Mail::Mbox object or the Sisimai::Mail::Maildir object. it's literally handing you the actual worker bee behind the wrapper 🐝

my $o = $mailbox->mail;
print ref $o;   # Sisimai::Mail::Mbox

πŸ”₯ read()

read() method works as an iterator for reading each email in the mbox or the Maildir. It calls Sisimai::Mail::Mbox-"read()> or Sisimai::Mail::Maildir-"read> methods.

bestie pay attention: this is the one you'll call in a while loop forever, it's the whole reason she exists πŸ™ˆ
my $mailbox = Sisimai::Mail->new('/var/mail/neko');
while( my $r = $mailbox->read ) {
    print $r;   # print each email in /var/mail/neko
}

slay. one email at a time. periodt πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

azumakuniyuki β€” the legend themselves 🌟


Copyright (C) 2014-2016,2018-2021,2024,2025 azumakuniyuki, All rights reserved.


πŸ’œ LICENSE πŸ’œ

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


and that's the whole page bestie!! πŸŽ€ this was brought to you by perl v5.40.1, dated 2026-07-05, from the Sisimai::Mail(3pm) corner of the manual β€” mwah, ily, go read your mail πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from