Email::MessageID(3)

✨ Email::MessageID πŸ’Œ

okay so bestie, we're looking at Email::MessageID(3) today β€” it lives in the User Contributed Perl Documentation corner of the manpage universe, and it's genuinely iconic. Let's get into it πŸ’…

🌸 NAME 🌸

Email::MessageID β€” generate world unique message-ids. that's it. that's the whole thing. no cap, that's what it does ✨

πŸŽ€ VERSION πŸŽ€

version 1.408 β€” write it down, iykyk 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe in four lines, literally:

use Email::MessageID;

my $mid = Email::MessageID->new->in_brackets;

print "Message-ID: $mid\x0D\x0A";

look at that. chef's kiss. πŸ”₯

πŸ’– DESCRIPTION πŸ’–

so message-ids are these headers that identify a message uniquely. are they required? nope β€” they're optional. but are they highly recommended? YES absolutely, bestie, do it. this software generates a unique message-id for you and honestly it ate. πŸ‘‘

πŸ’œ PERL VERSION πŸ’œ

this library should run on perls released even a long time ago. like, it should work on any version of perl released in the last five years. yes, five. the number between four and six. 🧚

and even though it may work on older versions of perl, there's no guarantee made that the minimum required version won't be increased. the version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. so like... don't come for her about downgrading. periodt. πŸ’€


🌈 METHODS 🌈

⭐ new

my $mid = Email::MessageID->new;

my $new_mid = Email::MessageID->new( host => $myhost );

this class method constructs an Email::MessageID object containing a unique message-id. so easy. you may specify custom "host" and "user" parameters if you're feeling extra πŸ’…

  • by default, the "host" is generated from Sys::Hostname::hostname.
  • by default, the "user" is generated using Time::HiRes's gettimeofday and the process ID.

using these values we have the ability to ensure world uniqueness down to a specific process running on a specific host, and the exact time down to six digits of microsecond precision. world uniqueness, bestie. six digits of microsecond precision. she's precise. ⏱️✨

⭐ create_host

my $domain_part = Email::MessageID->create_host;

this method returns the domain part of the message-id. the domain part! specifically! 🏠

⭐ create_user

my $local_part = Email::MessageID->create_user;

this method returns a unique local part for the message-id. it includes some random data and some predictable data β€” a little chaos, a little structure, the perfect balance honestly 🎭

⭐ in_brackets

when using Email::MessageID directly to populate the "Message-ID" field, be sure to use "in_brackets" to get the string inside angle brackets. angle brackets! the < and > ones! πŸ™ˆ

header => [
  ...
  'Message-Id' => Email::MessageID->new->in_brackets,
],

and please please please do not make this common mistake:

header => [
  ...
  'Message-Id' => Email::MessageID->new->as_string, # WRONG!
],
⚠️ see that # WRONG! in the comments? that's not me being dramatic, that's the manpage. as_string is WRONG here. use in_brackets. i'm not mad, i'm just disappointed. 😭

πŸ‘‘ AUTHORS πŸ‘‘

  • Casey West <casey@geeknest.com>
  • Ricardo SIGNES <cpan@semiotic.systems>

πŸ“ CONTRIBUTORS πŸ“

  • Aaron Crane <arc@cpan.org>
  • Pali <pali@cpan.org>
  • Ricardo Signes <rjbs@semiotic.systems>

this software is copyright (c) 2004 by Casey West.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free software! go off! 🌸


and that's the whole page bestie 🫢 footer deets so you know exactly which edition you're reading: perl v5.42.0, dated 2023-01-02, serving Email::MessageID(3) realness. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from