• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

testscripts/H22-Oct-2000-13959

Alias.pmH A D03-May-202215.8 KiB787352

ChangesH A D22-Oct-20001.3 KiB3122

MANIFESTH A D06-Sep-2000310 1111

Makefile.PLH A D06-Sep-2000439 2614

READMEH A D24-Sep-20008.7 KiB197149

test.plH A D06-Sep-20001.2 KiB3919

test_alias_fileH A D06-Sep-2000118 73

README

1INTRODUCTION
2This is the README file for the PERL module Mail::Alias
3for Version 1.12  13 September2000
4
5Mail::Alias is avaiable for download at www.CPAN.org under Mail modules
6or under the CPAN author ID: ZELT
7
8You require perl 5.001 or later to use this library
9	This is a legacy of the previous version of Mail::Alias that was
10	included in MailTools. This module may actually work with earlier
11	versions of PERL
12
13All files contained in this installation are Copyright (c) 2000
14Tom Zeltwanger. All rights reserved. This library is free software; you may
15redistribute it and/or modify it under the same terms as Perl itself.
16
17Note: There is breif Mail::Alias documentation embedded in the Mail::Alias module,
18which can be accessed by typing "man Mail::Alias" after installation or by typing
19"perldoc Alias.pm" in the directory containing Alias.pm
20
21-----------------------------------------------------------------------------
22Any questions or comments (Please send your feeback) should be addressed to -
23Tom Zeltwanger <perl@ename.com>                                             -
24-----------------------------------------------------------------------------
25
26
27INSTALLATION
28To install the library, run these commands:
29
30   perl Makefile.PL
31   make
32   make test
33   make install
34
35After installation, you should be able to see the brief documentation by typing
36"man Mail::Alias" You will now be able to access the Mail::Alias methods by adding
37"use Mail::Alias" to the beginning of your PERL program.
38
39
40SYNOPSYS
41This module allows direct manipulation of various types of E-Mail Alias files. The
42primary use of Mail::Alias is for manipulating alias files in the SENDMAIL
43alias file format. Additionally it is possible to read some other formats and to
44convert between various alias file formats.
45
46
47HISTORY
48The capabilities provided in this module were developed as part of the
49development of an E-mail Forwarding service (desibed in more detail at www.ename.com).
50The service is  based on SENDMAIL and uses PERL for automatic processing of Alias
51files. This code is being provided to the PERL community in appreciation for the
52free PERL software and the incredible support network that comes with PERL at no
53charge.
54
55This module also incorporates Alias code from the MailTools module written
56by Graham Barr. My appreciation to Graham for that  work, and for letting
57me combine our works, and assume authorship of Mail::Alias.
58
59
60DESCRIPTION
61
62MODULE OVERVIEW
63Mail::Alias allows you to directly access the contents of E-Mail alias files.
64You can perform the following actions:
65	Set the name of the current aliases file being accessed
66	Verify the presence of aliases
67	Retrieve an alias line from the file
68	Add aliases
69	Change the addresses for aliases
70	Delete aliases
71
72Direct access of the files has a small price. When files are being manipulated
73directly, operations are somewhat slower than they would be if the entire
74alias file contents was brought into memory first. However, this provides the
75most flexibility, and does not disrupt the ordering of the file, or any
76comments in the file. This delay factor will not be a problem unless you have
77huge alias files. After you make changes, don't forget you will need to rebuild
78the active alias database (for SENDMAIL this is done by executing the NEWALIASES
79command).
80
81For backward compatibility with earlier versions of Mail::Alias, there is a
82separate set of indirect access methods. These provide 100 percent interface-level
83compatibility with prior versions (versions before 1.10). The indirect methods
84act on files by reading them into memory first. This mode of operation will be
85referred to as MEMORY mode, while the normal mode of operating directly on the
86files will be referred to as the FILE mode.
87
88With the MEMORY mode, you can perform the following operations:
89	Read alias file contents into memory
90	Define the alias file format
91	Write alias data in memory to a new file
92	Expand an alias into its delivery addresses
93	Verify the existance of an alias in memory
94
95When possible, it is recommended that you use the FILE method for accessing
96your alias files. Future versions will concentrate on expanding the capabilities
97in FILE mode. Methods are also provided to make it easy to switch between FILE
98and MEMORY modes. If you are mainly interested in expansion of aliases for sending
99messages, MEMORY mode has a strong expansion method that properly handles
100recursion and :include: files.
101
102My descriptions of aliases and alias files will be obviously biased toward
103SENDMAIL, as it is the Mail Transport Agent (MTA) which with I am most familiar.
104I welcome comments from experts with non-SENDMAIL environments that will help to
105make this module as universally useful as possible. Most of the methods have been
106written specifically for manipulating SENDMAIL alias files.
107
108
109INTERFACE
110The interface is Object Oriented, so familiarity with OO PERL is
111requried. Using a PERL OO module is very easy, and is well described in
112several books.
113
114To use the module you must first add the line "use Mail::Alias" in your code.
115Nest, you will create an Alias object using the standard new() constructor
116method. After you have created the object, you use method calls that pass a
117reference to a hash (e.g. $my_object->exists("some_alias")). You can not use
118functional-style calls to the Mail::Alias methods because the names are not
119exported, and they all expect that the name of the object class will be passed
120as the first argument.
121
122
123METHODS
124The operation of each method is described briefly below. Usage syntax is
125shown in the embedded documentation in Alias.pm which is also found in the
126man page. As mentioned earlier, most of the methods are specific to either the
127FILE mode or the MEMORY mode. Please note that a few methods are used in both modes.
128To help make the method usage easier to understand, there are several test scripts in the
129testscripts directory that should help to explain the usage.
130
131
132FILE MODE METHODS
133Objects that are created for FILE mode access must be in SENDMAIL format. If you
134have an alias file in another format, you may first use the MEMORY modes to define
135the file format, read the alias file data, change to Sendmail format, and write
136the file in the Sendmail format.
137
138<new ()> - Creates an Alias object using the specified filename
139The class name should be specified only as Mail::Alias
140If no filenam is passed, it uses the standard SENDMAIL alias file: /etc/mail/aliases
141
142<exists ()> - Indicates the presence of the passed alias in the current aliases
143file and returns the entire line from the file it the alias is found. The returned
144line will be in the form [alias: address_string] where the address_string is comprised
145of one, or more E-Mail addresses or aliases also in the file. If the alias is not found in
146the file, exists() returns an undefined value.
147
148<alias_file ()> - Sets or gets the name of the current alias filename for
149direct access.
150
151<append () - Adds an alias to an existing Sendmail alias
152file. The alias and addresses can be passed as two separate arguments
153(alias, addresses) or as a single line of text (alias: addresses). If
154the alias is already in the file, an undefined value is returned.
155
156<delete () - Deletes the entry for an alias from the
157current alias file.
158
159<update () - Replaces the address string entry for an
160alias in the current alias file.
161
162<usemem ()> - Sets the working mode to MEMORY. Methods specific to the MEMORY
163mode are read(), write() and format() methods.
164
165
166MEMORY MODE METHODS
167<new ()> - Creates an Alias module using a specified format
168The class for creating objects ofr MEMORY mode access must include the file format
169(e.g. Mail::Alias::Sendmail).
170
171<read ()> Reads an alias file of the specified format into memory. Comments
172or blank lines are lost upon reading. Due to storage in a hash, ordering of
173the alias lines is also lost.
174
175<write ()> - The current set of aliases contained in the object memory is
176written to a file using the current format. If a filehandle is passed, data
177is written to the already opened file. If a filename is passed, it is opened
178and the memory is written to the file. Note: if passing a filename, include
179the mode (i.e. to write to a file named aliases pass >aliases). Before
180writing, the alias lines are sorted alphabetically.
181
182<exists ()> - Indicates the presence of the passed alias within the object
183after a file has been read.
184
185<expand ()> - Expands the passed alias into a list of addresses. Expansion
186properly handles :include: files, recursion, and continuation lines. If the alias
187is not found in the object, you get back what you sent.
188
189<format ()> Set the current alias file format. Currently available formats include
190Sendmail, Binmail, and Ucbmail. Each format has read and write methods.
191
192<usefile ()> - Sets the working mode to FILE. Methods specific to the FILE
193mode are append() and delete() methods.
194
195
196
197