Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::server::mail::esmtp::xforward(3pm) [debian man page]

Net::Server::Mail::ESMTP::XFORWARD(3pm) 		User Contributed Perl Documentation		   Net::Server::Mail::ESMTP::XFORWARD(3pm)

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. o get_forwarded_values : returns a hash reference containing all values forwarded (keys in lower case). o get_forwarded_name : returns the up-stream hostname. The hostname may be a non-DNS hostname. o get_forwarded_address : returns the up-stream network address. Address information is not enclosed with []. The address may be a non-IP address. o get_forwarded_source : returns LOCAL or REMOTE. o get_forwarded_helo : returns the hostname that the up-stream host announced itself. It may be a non-DNS hostname. o get_forwarded_proto : returns the mail protocol for receiving mail from the up-stream host. This may be an SMTP or non-SMTP protocol name of up to 64 characters. SEE ALSO
Net::Server::Mail::ESMTP, <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. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 167: You forgot a '=back' before '=head1' perl v5.10.0 2007-04-09 Net::Server::Mail::ESMTP::XFORWARD(3pm)

Check Out this Related Man Page

Server::Client(3pm)					User Contributed Perl Documentation				       Server::Client(3pm)

NAME
Net::SMTP::Server::Client - Client session handling for Net::SMTP::Server. SYNOPSIS
use Carp; use Net::SMTP::Server; use Net::SMTP::Server::Client; use Net::SMTP::Server::Relay; $server = new Net::SMTP::Server('localhost', 25) || croak("Unable to handle client connection: $! "); while($conn = $server->accept()) { # We can perform all sorts of checks here for spammers, ACLs, # and other useful stuff to check on a connection. # Handle the client's connection and spawn off a new parser. # This can/should be a fork() or a new thread, # but for simplicity... my $client = new Net::SMTP::Server::Client($conn) || croak("Unable to handle client connection: $! "); # Process the client. This command will block until # the connecting client completes the SMTP transaction. $client->process || next; # In this simple server, we're just relaying everything # to a server. If a real server were implemented, you # could save email to a file, or perform various other # actions on it here. my $relay = new Net::SMTP::Server::Relay($client->{FROM}, $client->{TO}, $client->{MSG}); } DESCRIPTION
The Net::SMTP::Server::Client module implements all the session handling required for a Net::SMTP::Server::Client connection. The above example demonstrates how to use Net::SMTP::Server::Client with Net::SMTP::Server to handle SMTP connections. $client = new Net::SMTP::Server::Client($conn) Net::SMTP::Server::Client accepts one argument that must be a handle to a connection that will be used for communication. Once you have a new client session, simply call: $client->process This processes an SMTP transaction. THIS MAY APPEAR TO HANG -- ESPECIALLY IF THERE IS A LARGE AMOUNT OF DATA BEING SENT. Once this method returns, the server will have processed an entire SMTP transaction, and is ready to continue. Once $client->process returns, various fields have been filled in. Those are: $client->{TO} -- This is an array containing the intended recipients for this message. There may be multiple recipients for any given message. $client->{FROM} -- This is the sender of the given message. $client->{MSG} -- The actual message data. :) AUTHOR AND COPYRIGHT Net::SMTP::Server / SMTP::Server is Copyright(C) 1999, MacGyver (aka Habeeb J. Dihu) <macgyver@tos.net>. ALL RIGHTS RESERVED. You may distribute this package under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
Net::SMTP::Server::Server, Net::SMTP::Server::Relay perl v5.10.1 1999-12-28 Server::Client(3pm)
Man Page