Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  POE::FILTER::TRANSPARENT::SMTP (3)

.ds Aq ’


POE::Filter::Transparent::SMTP - Make SMTP transparency a breeze :)





 use POE::Filter::Transparent::SMTP;

 my @array_of_things = (
     q{.first thing(no new line)},
     qq{.second thing (with new line)\n},
     q{.third thing (no new line},
     q{.}, # this is the message terminator, so it shouldnt be
           # prepended with an extra dot
 my $filter = POE::Filter::Transparent::SMTP->new( );
 my $lines = $filter->put( \@array_of_things );


The filter aims to make SMTP data transparent just before going onto the wire as per RFC 821 Simple Mail Transfer Protocol Section 4.5.2. TRANSPARENCY. See <> for details.

Conversely the filter takes transparent data from the wire and converts it to the original format.

The main purpose of this filter is to help POE::Component::Client::SMTP create transparent messages when comunicating with an SMTP server. However the filter can be used by any Perl SMTP client or server.

Internally it uses POE::Filter::Line in order to split messages into lines. Also as stated in the RFC every line it puts on the wire is ended by <CRLF>.

When receiving data from the wire (as it is the case for an SMTP server), lines should be separated with <CRLF> as the RFC specifies. However this is not always true as some SMTP clients are broken. So if you are using the filter on the receiving end maybe you would like to specify a regular expression that is more flexible for the line terminator.


All methods are conforming to POE::Filter specs. For more details have a look at POE::Filter documentation.


 my $filter = POE::Filter::Transparent::SMTP->new(
     InputLiteral => qq{\015\012},
      OutputLiteral => qq{\015\012},

Creates a new filter.

It accepts four optional arguments:
InputLiteral InputLiteral is the same as InputLiteral for POE::Filter::Line

It defaults to whatever POE::Filter::Line is defaulting. Currently POE::Filter::Line tries to auto-detect the line separator, but that may lead to a race condition, please consult the POE::Filter::Line documentation.

OutputLiteral OutputLiteral is the same as OutputLiteral for POE::Filter::Line

It defaults to <B>CRLFB> if not specified otherwise.

Warn In case get_one receives lines starting with a leading dot and Warn is enabled it issues a warning about this. By default the warning is disabled.
EscapeSingleInputDot In case you want to escape the single dot when reading data.

The parameter is useful for escaping single dots on a line when reading message bodies. Don’t use this for filtering entire SMTP transaction logs as it will ruin your command ’.’

<B>DefaultsB> to false

    get_one_start ARRAYREF

 $filter->get_one_start( $array_ref_of_formatted_lines );

Accepts an array reference to a list of unprocessed chunks and adds them to the buffer in order to be processed.


 my $array_ref = $filter->get_one(); my $line = $array_ref->[0];

Returns zero or one processed record from the raw data buffer. The method is not greedy and is the preffered method you should use to get processed records.

    get ARRAY_REF

 my $lines = $filter->get( $array_ref_of_formatted_lines );
 for (my $i = 0; $i < scalar @{$lines}; $i++ ) {
     # do something with $lines->[$i];

get is the greedy form of get_one and internally is implemented as one call of get_one_start and a loop of get_one.

Normally you shouldn’t use this as using get_one_start and get_one would make filter swapping easyer.

    put ARRAYREF

 my @array_of_things = (
     q{.first thing(no new line)},
     qq{.second thing (with new line)\n},
     q{.third thing (no new line}, q{.},
 my $lines = $filter->put( \@array_of_things );
 print Dumper( $lines );

would return something similar as below

 $VAR1 = [
          ..first thing(no new line)
          ..second thing (with new line)

          ..third thing (no new line

put takes an array ref of unprocessed records and prepares them to be put on the wire making the records SMTP Transparent.


Returns a list of data that is in the buffer (without clearing it) or undef in case there is nothing in the buffer.


 my $new_filter = $filter->clone();

Clones the current filter keeping the same parameters, but with an empty buffer.


POE POE::Filter POE::Filter::Line POE::Component::Client::SMTP POE::Component::Server::SimpleSMTP


By default, InputLiteral is set to the default POE::Filter::Line which can become an issue if you are using the filter on the receiving end.


Please report any bugs or feature requests to bug-poe-filter-transparent-smtp at, or through the web interface at <>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc POE::Filter::Transparent::SMTP

You can also look for information at:
o RT: CPAN’s request tracker


o AnnoCPAN: Annotated CPAN documentation


o CPAN Ratings


o Search CPAN



Thanks to Jay Jarvinen who pointed out that POE::Component::Client::SMTP is not doing SMTP transparency as it should (RFC 821, Section 4.5.2. TRANSPARENCY)


George Nistorica, ultradm __at cpan __dot org


Copyright 2008-2009 George Nistorica, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 POE::FILTER::TRANSPARENT::SMTP (3) 2009-01-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.