The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
        $self -> create_domain();
        $self -> create_user_account();
        $self -> stop_server();

        $self -> create_postmaster_account();
        $self -> update_dirs_and_files();
        $self -> info("Starting '$$self{'_xmail_debug'}' with the new config files");
        $self -> info('o Server must be up for it to receive mail');
        $self -> info("o Sending a test message to $$self{'_options'}{'user_name'}");

        $process = $self -> start_server();

        $self -> send_test_message();
        $self -> receive_test_message();
        $self -> stop_server();
        $self -> install_and_start_service();

NAME

XMail::Install - A module to install the MS Windows mail server XMail

Synopsis

        #!/usr/bin/perl

        use strict;
        use warnings;

        use XMail::Install;

        # -----------------

        my(%option) = (...);

        XMail::Install -> new(options => \%option) -> run();

See the next section for details.

Description

XMail::Install is a pure Perl module. It only runs under MS Windows.

It will read an unpacked distro of the XMail mail server, and install, configure and test it.

Also, it will stop and remove the service if it is already running.

So, download xmail-1.25.win32bin.zip from http://xmailserver.org/ and unpack it into c:\. This creates c:\xmail-1.25.

        Then:
        Unpack the distro.
        shell>cd examples
        shell>perl install-xmail-1.pl -h
        shell>perl install-xmail-1.pl -v -other -options
        shell>perl install-xmail-2.pl -v -other -options

The reason for having 2 install programs is that I could not get 1 to work properly, neither under Win2FK nor WinXFP. Sometimes it would work, and sometimes it would not.

Distributions

This module is available as a Unix-style distro (*.tgz).

See http://savage.net.au/Perl-modules.html for details.

See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing.

Constructor and initialization

new(...) returns an object of type XMail::Install.

This is the class's contructor.

Usage: XMail::Install -> new().

This method takes a hashref of options. There are no mandatory options.

Call new() as new(options => {key_1 => value_1, key_2 => value_2, ...}).

domain_name

This is the name of your mail domain.

The default is xmail.net.

in_dir

This is the name of the directory into which you unpacked XMail.

The default is c:\xmail-1.25.

out_dir

This is the name of the directory into which XMail's default directory MailRoot will be installed.

The default is c:\, so XMail will be installed into c:\MailRoot.

Also, executables in the distro dir c:\xmail-1.25\bin will be copied to c:\MailRoot\bin.

postmaster_password

This is the password of the postmaster (admin) account.

The default is 'richness-of-martens'.

server

This is the IP address, or name, of the host on which the XMail service will be running.

The default is 127.0.0.1.

user_name

This is the name of a user (non-admin) account.

The default is 'rsavage'.

user_password

This is the password of the user account.

The default is 'skulk-of-foxes'.

verbose

This is the flag which controls the amount of progress messages printed.

Values are 0 or 1.

The default is 0.

Method: copy_dirs_and_files

A convenience method which makes the main line code in method run() simpler.

Actually, except for new() and run(), all methods in the class are convenience methods.

Method: create_account

Update ctrlaccounts.tab with the details of the user 'xmailuser'.

Method: create_domain

Use the XMail ctrlclnt program to create a mail domain.

Method: create_postmaster_account

Create XMail's postmaster account and password.

Method: create_user_account

Create an XMail user account and password.

Method: info

Print progress messages, while checking the verbose switch.

Method: install_and_start_service

This installs and starts the XMail service.

Method: receive_test_message

Receive and print the test message sent by method send_test_message.

Method: run

Do all the work required to install XMail.

This is achieved by calling all the convenience methods in the class.

Method: send_test_message

Send a test message, which will be received by method receive_test_message.

Method: start_server

Start the XMail program as a process, not as a service.

Method: stop_and_remove_service

Stop the XMail service, and then remove it.

Method: stop_server

Stop the XMail program.

Method: update_dirs_and_files

Update various directories and files.

Method: update_the_registry

Update the registry, if necessary, being careful to preserve data in the immediate vicinity of the new keys.

Method: win32_error

Return the last error available from the OS.

FAQ

Why did you write this module?

To explicitly document a minimum set of steps I believe are required to install XMail.

This allows to me very simply install XMail on more than one system and, in the same way, it allows anyone to very simply set up a mail server to experiment with.

Email me if you have any suggestions regarding the steps I've implemented.

How secure is XMail?

Well, you'll need to investigate XMail itself to answer that question. See http://www.xmailserver.org/

But we can say mail server security is a complex issue, and installing a mail server should not be done lightly.

At the absolute minimum, you should not use the default passwords shipped with this module.

Why did you use passwords such as 'richness-of-martens' anyway?

Firstly, as a way of drawing you attention to the problem of choosing good passwords, and secondly because I like playing with the English language.

And yes, 'a richness of martens' is correct English, where martens refers to a type of bird, and richness is the corresponding collective noun. The same goes for 'skulk-of-foxes'.

One source of passwords is https://www.grc.com/passwords.htm

Which versions of XMail did you test this module against?

V 1.22 and V 1.24.

Is XMail your primary mail server?

No. I use a commercial web hosting company, http://www.quadrahosting.com.au/

The way I use XMail is by restricing the clients which can talk to it to be clients with IP addresses in the ranges 192.168.*.* and 10.*.*.*.

Why don't you use the module XMail::Ctrl?

I examined it, and decided it wasn't quite relevant.

What's with this word daemon?

A daemon is what Microsoft, and others, call a service.

See http://en.wikipedia.org/wiki/Daemon_%28computer_software%29 for an explanation.

Required Modules

Carp
Email::Send
File::Copy
File::Copy::Recursive
File::Path
Mail::POP3Client
Path::Class
Win32
Win32::Process
Win32::Process::List
Win32::Service
Win32::TieRegistry

Author

XMail::Install was written by Ron Savage in 2007. [ron@savage.net.au]

Home page: http://savage.net.au/index.html

Copyright

Australian copyright (c) 2007, Ron Savage. All rights reserved.

        All Programs of mine are 'OSI Certified Open Source Software';
        you can redistribute them and/or modify them under the terms of
        The Artistic License, a copy of which is available at:
        http://www.opensource.org/licenses/index.html