Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Net::Server::Mail::ESMTP::XFORWARD
A module to add support to the XFORWARD command in Net::Server::Mail::ESMTP

Net::Server::Mail::ESMTP::XFORWARD - A module to add support to the XFORWARD command in Net::Server::Mail::ESMTP


NAME

Net::Server::Mail::ESMTP::XFORWARD - A module to add support to the XFORWARD command in Net::Server::Mail::ESMTP


SYNOPSIS


    use Net::Server::Mail::ESMTP;

    my @local_domains = qw(example.com example.org);

    my $server = new IO::Socket::INET Listen => 1, LocalPort => 25;

    my $conn;

    while($conn = $server->accept)

    {

        my $esmtp = new Net::Server::Mail::ESMTP socket => $conn;

        # activate some extensions

        $esmtp->register('Net::Server::Mail::ESMTP::XFORWARD');

        # adding some handlers

        $esmtp->set_callback(RCPT => \&validate_recipient);

        $esmtp->process();

        $conn->close()

    }

    sub validate_recipient

    {

        my($session, $recipient) = @_;

        my $domain;

        if($recipient =~ /@(.*)>\s*$/)

        {

            $domain = $1;

        }

        if(not defined $domain)

        {

            return(0, 513, 'Syntax error.');

        }

        elsif(not(grep $domain eq $_, @local_domains) && $session->get_forwarded_addr != "10.1.1.1")

        {

            return(0, 554, "$recipient: Recipient address rejected: Relay access denied");

        }

        return(1);

    }


DESCRIPTION

When using a Net::Server::Mail::ESMTP script inside a MTA and not in front of Internet, values like client IP address are not accessible to the script and when the script returns mail to an other instance of smtpd daemon, it logs ``localhost'' as incoming address. To solve this problem, some administrators use the XFORWARD command. This module gives the ability to read and store XFORWARD informations.

METHODS

These methods return the values set by the upstream MTA without modifying them so they can be set to undef or ``[UNVAILABLE]''. See Postfix documentation for more.


SEE ALSO

the Net::Server::Mail::ESMTP manpage, http://www.postfix.org/XFORWARD_README.html


AUTHOR

Xavier Guimard, <x.guimard@free.fr>


COPYRIGHT AND LICENSE

Copyright (C) 2006 by Xavier Guimard

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.4 or, at your option, any later version of Perl 5 you may have available.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy