Email::MessageID(3pm)

Email::MessageID3pm

Generate world unique message-ids.

Usage

  use Email::MessageID;
  my $mid = Email::MessageID->new->in_brackets;
  print "Message-ID: $mid\x0D\x0A";

Version

version 1.408

Overview

Message-ids are optional, but highly recommended, headers that identify a message uniquely. This software generates a unique message-id.

Perl version

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not 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.

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. You may specify custom "host" and "user" parameters.

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.

create_host

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

This method returns the domain part of the message-id.

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.

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:

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

Don't make this common mistake:

  header => [
    ...
    'Message-Id' => Email::MessageID->new->as_string, # WRONG!
  ],

Contributors

•

Aaron Crane <[email protected]>

•

Pali <[email protected]>

•

Ricardo Signes <[email protected]>

Releases

11 releases since Debian 4.0 (Etch); the text changed 6 times.

  1. 4.0
  2. 5.0
  3. 6.0–7
  4. 8
  5. 9–11
  6. 12–13
  7. Arch

Authors

•

Casey West <[email protected]>

•

Ricardo SIGNES <[email protected]>

From perl-email-messageid 1.408-4 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.