POE::Fi...t::SMTP(3)
π POE::Filter::Transparent::SMTP π
okay bestie, so this is POE::Filter::Transparent::SMTP from the User Contributed Perl Documentation, and it's genuinely one of those little modules that does one thing and does it adorably. it makes SMTP transparency a breeze, literally that's the tagline, i'm not even being cute πΈ
VERSION: 0.2 β¨
π¦ SYNOPSIS π¦
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 shouldn't be
# prepended with an extra dot
);
my $filter = POE::Filter::Transparent::SMTP->new( );
my $lines = $filter->put( \@array_of_things );
π DESCRIPTION π
so the whole vibe of this filter is: it makes your SMTP data transparent right before it goes out on the wire, exactly like RFC 821 Simple Mail Transfer Protocol Section 4.5.2. TRANSPARENCY says you should. the receipts are at <http://www.faqs.org/rfcs/rfc821.html> if you wanna read the lore yourself π
and it goes both ways, bestie β the filter also takes transparent data coming off the wire and converts it back to the original format. reversible queen π
the main character purpose here is helping POE::Component::Client::SMTP build transparent messages when it's chatting with an SMTP server. that said, literally any Perl SMTP client or server can use this filter, no gatekeeping π«Ά
under the hood it uses POE::Filter::Line to chop messages into lines. and like the RFC demands, every single line it puts on the wire gets ended by <CRLF>. periodt.
now here's the tea β β when you're receiving data from the wire (say, if you're an SMTP server), lines are supposed to be separated with <CRLF> because that's what the RFC says. but not every SMTP client is well-behaved and some of them are just broken, fr fr. so if you're on the receiving end, maybe you wanna hand it a regular expression that's more flexible about the line terminator. your call, your rules π
π METHODS π
every method here conforms to POE::Filter specs, no cap. want more details? go read the POE::Filter documentation, it's all there π
β¨ new HASHREF_OF_PARAMETERS β¨
my $filter = POE::Filter::Transparent::SMTP->new(
InputLiteral => qq{\015\012},
OutputLiteral => qq{\015\012},
);
creates a brand new filter, slay π
it takes four optional arguments, here's the rundown:
- InputLiteral β this is the same as
InputLiteralforPOE::Filter::Line. it defaults to whateverPOE::Filter::Linedefaults to. heads up though: currentlyPOE::Filter::Linetries to auto-detect the line separator, and that can lead to a race condition π so pls go consult thePOE::Filter::Linedocumentation before you get got. - OutputLiteral β this is the same as
OutputLiteralforPOE::Filter::Line. if you don't say otherwise, it defaults to CRLF. - Warn β if
get_onereceives lines starting with a leading dot, andWarnis enabled, it issues a warning about it. by default this warning is disabled. (not me silently judging those linesβ¦ π) - EscapeSingleInputDot β turn this on if you wanna escape the single dot when reading data. it's useful for escaping single dots on a line while reading message bodies. β οΈ do NOT use this for filtering entire SMTP transaction logs, because it will ruin your command
.and you'll be sad. defaults tofalse.
πΈ get_one_start ARRAYREF πΈ
$filter->get_one_start( $array_ref_of_formatted_lines );
takes an array reference full of unprocessed chunks and adds them to the buffer so they can get processed. simple as that β¨
π get_one π
my $array_ref = $filter->get_one(); my $line = $array_ref->[0];
returns zero or one processed record from the raw data buffer. this method is not greedy, and it's the preferred way to pull processed records, iykyk π
π¦ 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 version of get_one, and internally it's just one call to get_one_start plus a loop of get_one. that's it, that's the whole recipe π
normally you shouldn't reach for this one, because using get_one_start and get_one makes filter swapping easier. (easier swapping = happier you, bestie π
)
π 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 preps them to be put on the wire, making those records SMTP Transparent. iconic behavior, truly π
π get_pending π
returns a list of the data sitting in the buffer (without clearing it, okay, it's just looking, not touching π) or undef if there's nothing in the buffer at all.
π clone π
my $new_filter = $filter->clone();
clones the current filter, keeping all the same parameters but with a fresh empty buffer. a little baby filter, born from your filter π§
β SEE ALSO β
POE POE::Filter POE::Filter::Line POE::Component::Client::SMTP POE::Component::Server::SimpleSMTP
π KNOWN ISSUES π
by default, InputLiteral is set to the default POE::Filter::Line, and that can become an issue if you're using the filter on the receiving end. not a crisis, just a heads up bestie π
π BUGS π
pls report any bugs or feature requests to bug-poe-filter-transparent-smtp at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Filter-Transparent-SMTP>. i (the author) will be notified, and then you'll automatically be notified of progress on your bug as changes get made. it's a whole little notification pipeline, we love to see it π«Ά
π SUPPORT π
you can find documentation for this module with the perldoc command:
perldoc POE::Filter::Transparent::SMTP
you can also look for information at:
- RT: CPAN's request tracker β
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Filter-Transparent-SMTP> - AnnoCPAN: Annotated CPAN documentation β
<http://annocpan.org/dist/POE-Filter-Transparent-SMTP> - CPAN Ratings β
<http://cpanratings.perl.org/d/POE-Filter-Transparent-SMTP> - Search CPAN β
<http://search.cpan.org/dist/POE-Filter-Transparent-SMTP>
πΈ ACKNOWLEDGMENTS πΈ
huge thanks to Jay Jarvinen, who pointed out that POE::Component::Client::SMTP was not doing SMTP transparency the way it should (RFC 821, Section 4.5.2. TRANSPARENCY). king behavior, honestly π
π AUTHOR π
George Nistorica, ultradm __at cpan __dot org
π COPYRIGHT & LICENSE π
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.
and that's the whole page, bestie π this was perl v5.42.0, dated 2025-07-25, straight from the POE::Fi...t::SMTP(3) manual β mwah, go forth and be transparent (the SMTP kind) πβ¨
π¦ where this page comes from
- fedora 43: perl-POE-Filter-Transparent-SMTP 0.2-50.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms