1Email::MessageID(3) User Contributed Perl Documentation Email::MessageID(3)
2
3
4
6 Email::MessageID - Generate world unique message-ids.
7
9 version 1.408
10
12 use Email::MessageID;
13
14 my $mid = Email::MessageID->new->in_brackets;
15
16 print "Message-ID: $mid\x0D\x0A";
17
19 Message-ids are optional, but highly recommended, headers that identify
20 a message uniquely. This software generates a unique message-id.
21
23 This library should run on perls released even a long time ago. It
24 should work on any version of perl released in the last five years.
25
26 Although it may work on older versions of perl, no guarantee is made
27 that the minimum required version will not be increased. The version
28 may be increased for any reason, and there is no promise that patches
29 will be accepted to lower the minimum required perl.
30
32 new
33 my $mid = Email::MessageID->new;
34
35 my $new_mid = Email::MessageID->new( host => $myhost );
36
37 This class method constructs an Email::MessageID object containing a
38 unique message-id. You may specify custom "host" and "user" parameters.
39
40 By default, the "host" is generated from "Sys::Hostname::hostname".
41
42 By default, the "user" is generated using "Time::HiRes"'s
43 "gettimeofday" and the process ID.
44
45 Using these values we have the ability to ensure world uniqueness down
46 to a specific process running on a specific host, and the exact time
47 down to six digits of microsecond precision.
48
49 create_host
50 my $domain_part = Email::MessageID->create_host;
51
52 This method returns the domain part of the message-id.
53
54 create_user
55 my $local_part = Email::MessageID->create_user;
56
57 This method returns a unique local part for the message-id. It
58 includes some random data and some predictable data.
59
60 in_brackets
61 When using Email::MessageID directly to populate the "Message-ID"
62 field, be sure to use "in_brackets" to get the string inside angle
63 brackets:
64
65 header => [
66 ...
67 'Message-Id' => Email::MessageID->new->in_brackets,
68 ],
69
70 Don't make this common mistake:
71
72 header => [
73 ...
74 'Message-Id' => Email::MessageID->new->as_string, # WRONG!
75 ],
76
78 • Casey West <casey@geeknest.com>
79
80 • Ricardo SIGNES <cpan@semiotic.systems>
81
83 • Aaron Crane <arc@cpan.org>
84
85 • Pali <pali@cpan.org>
86
87 • Ricardo Signes <rjbs@semiotic.systems>
88
90 This software is copyright (c) 2004 by Casey West.
91
92 This is free software; you can redistribute it and/or modify it under
93 the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.38.0 2023-07-20 Email::MessageID(3)