Mail-IspMailGate

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        surprisingly much space. By default /var/spool/ispmailgate is used.

    --unix-sock=<sock>
        Tells the server to listen on file <sock> for unix socket
        connections. By default the server uses /var/run/ispmailgate.sock.

INSTALLATION
  Requirements

    To start with the requirements: You need

    1.) A running sendmail (recommended: 8.9.3 or later); if you don't have
    sendmail or an older version, you find the current release at

        ftp://ftp.sendmail.org/pub/sendmail

    2.) A late version of Perl (5.005 or later); if you don't have Perl, get
    it from any CPAN mirror, for example

        ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0

    3.) The MIME-tools module (version 4.116 or later), its prerequired
    modules (MailTools, MIME-Base64 and IO-Stringy) and the IO::Tee module
    (version 0.61 or later). All these modules are available from any CPAN
    mirror, for example

        ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/Mail
        ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/MIME
        ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/IO

    Installing a Perl module is quite easy, btw. Either you use the
    automatic CPAN interface (requires an Internet connection or something
    similar) by executing

        perl -MCPAN -e shell

    or you fetch the modules with FTP, extract the tar.gz files, go into the
    distribution directory (for example MIME-tools-4.116) and do a

        perl Makefile.PL
        make
        make test
        make install

    You'll like it! :-)

  System preparation

    Although ispMailGate is usually started as root, because certain
    initialization settings need root permissions, it must not continue
    running as root. Instead it impersonates itself to the same UID and GID
    that sendmail uses for delivering mails. In what follows, I assume UID
    *daemon* and GID <mail>, as used on a Red Hat Linux box.

    IspMailGate needs its own directory for creating temporary files.
    Usually this could be `/var/spool/ispmailgate' or something similar.
    Make sure that the daemon user from above, (but noone else) has access
    to this directory:

        mkdir /var/spool/ispmailgate
        chown daemon /var/spool/ispmailgate
        chgrp mail /var/spool/ispmailgate
        chmod 700 /var/spool/ispmailgate

  Program installation

    The program is installable like any other Perl module. Indeed, you can
    even use the automatic CPAN installation. If you are not used to CPAN
    installation or cannot use the CPAN shell, you need to perform a manual
    installation: First, fetch the archive from any CPAN mirror, for example

        ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/JWIED

    and extract the archive with

        gzip -cd Mail-IspMailGate-<version>.tar.gz | tar xf -

    After that, do a

        cd Mail-IspMailGate-<version>

    and do a

        perl Makefile.PL
        make
        make test           # You need to be root here!
        make install        # You need to be root here!

    While running "perl Makefile.PL", you'll be prompted a lot of questions.
    In general you can answer them by simply hitting return, the defaults
    should be fine. The questions are explained in the section CONFIGURATION
    FILE below, because your answers are used for creating this config file.
    the section on "CONFIGURATION FILE".

    If "make test" reports any errors, let me know.

SENDMAIL CONFIGURATION
    To understand the required sendmail configuration, let's first take a
    look at the following diagram:

            +----------------+
            | Incoming       |
            | mail for       |
            | joe@ispsoft.de |
            +----------------+

                |
                | Port 25
                | (SMTP)
                |

            +----------------------+        +---------------------+
            |                      |        |                     |
            |  Sendmail, with      |        |  IspMailGate        |
            |  IspMailGate support |  ----> |  receives and       |
            |  integrated          |        |  processes the mail |
            |                      |        |                     |
            +----------------------+        +---------------------+

               V                                    |
                                                    |

README  view on Meta::CPAN

    /etc/mail/sendmail.mc
          divert(-1)
          include(`/usr/lib/sendmail-cf/m4/cf.m4')
          define(`confCW_FILE', `/etc/mail/sendmail.cw')
          define(`ALIAS_FILE', `/etc/mail/aliases')
          define(`QUEUE_DIR', `/var/spool/mqueue')
          OSTYPE(`linux')
          FEATURE(use_cw_file)
          FEATURE(mailertable, `hash -o /etc/mail/mailertable')
          FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')
          FEATURE(access_db)
          MAILER(local)
          MAILER(smtp)
          MAILER(ispmailgate)

    /etc/mail2/sendmail.mc
          divert(-1)
          include(`/usr/lib/sendmail-cf/m4/cf.m4')
          define(`confCW_FILE', `/etc/mail/sendmail.cw')
          define(`ALIAS_FILE', `/etc/mail/aliases')
          define(`QUEUE_DIR', `/var/spool/mqueue2')
          define(`confDAEMON_OPTIONS', `port=26')
          OSTYPE(`linux')
          FEATURE(use_cw_file)
          FEATURE(mailertable, `hash -o /etc/mail2/mailertable')
          FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')
          FEATURE(access_db)
          MAILER(local)
          MAILER(smtp)

        You see, this is almost the same file, with three exceptions:

    1.)     The first sendmail is running on the default port 25, because it has
            no special port settings. The second sendmail is running on port
            26.

    2.)     The first sendmail is using /etc/mail/mailertable, the second has
            /etc/mail2/mailertable.

    3.)     The second sendmail doesn't have a mailer ispmailgate.

    4.)     The first sendmail is using another spool directory,
            /var/spool/mqueue2. (I am not sure, whether this is required,
            however it doesn't harm, so let's be on the safe side.)

    /etc/mail/mailertable
          ispsoft.de    ispmailgate:ispsoft.de

    /etc/mail2/mailertable
          ispsoft.de    ispmailgate:mail.ispsoft.de

        You see, the only difference between these two instances of
        mailertable is that the domain *ispsoft.de* is treated different.

    Finally we have to execute some commands to get this configuration
    running:

            mkdir /var/spool/mqueue2
            # The following should match the settings of
            # /var/spool/mqueue exactly.
            chown root /var/spool/mqueue2
            chgrp root /var/spool/mqueue2
            chmod 755 /var/spool/mqueue

            cd /etc/mail
            m4 sendmail.mc >sendmail.cf
            makemap hash mailertable <mailertable
            cd /etc/mail2
            m4 sendmail.mc >sendmail.cf
            makemap hash mailertable <mailertable

    The above is fine for Linux. On other operating systems you might need
    to use GNU m4 rather than the builtin m4 and replace the map type *hash*
    with *dbm*. In particular this applies to Solaris.

    Finally, kill any running sendmail and start the new versions with

            chmod 755 /etc/mail /etc/mail2
            chmod 644 /etc/mail/sendmail.cf /etc/mail2/sendmail.cf
            /usr/sbin/sendmail -C /etc/mail/sendmail.cf -bd -q1h
            /usr/sbin/sendmail -C /etc/mail2/sendmail.cf -bd -q1h

    (The chmod commands because sendmail is *really* picky about group
    writable files and directories.)

CONFIGURATION FILE
    The program depends on a local configuration file, read as the
    Mail::IspMailGate::Config module. In other words, this configuration
    file is pure Perl code defining certain variables under the name space
    Mail::IspMailGate::Config. The module is read from the file
    /usr/lib/perl5/site_perl/5.005/Mail/IspMailGate/Config.pm.

    The following variables are meaningful to the program:

    VERSION
        The programs version; do not modify without a good reason.

    tmp_dir
        Set's the default directory for creating temporary files, currently
        /var/spool/ispmailgate. You can modify this with the `--tmpdir'
        directive, see above.

    unix_sock
        The unix socket that the client connects to, currently
        /var/run/ispmailgate.sock. You can use the `--unixsock' argument for
        overwriting the default.

    pid_file
        The PID file where a running server stores its PID, currently
        /var/run/ispmailgate.pid. You can use the `--pidfile' argument for
        overwriting the default.

    mail_user
    mail_group
        IspMailGate is running as this user and group, by default daemon and
        mail.

    mail_host
        The host to use for passing mails after processing them by the mail
        filter. By default 'localhost' is used, in other words, the mails
        are immediately passed back to sendmail.



( run in 0.538 second using v1.01-cache-2.11-cpan-71847e10f99 )