Qpsmtp...nection(3pm)

πŸ’Œ Qpsmtpd::Connection β€” the manual page, but make it cute

okay bestie, you're looking at Qpsmtpd::Connection, a Perl module from the User Contributed Perl Documentation corner of the universe, and it's literally just "A single SMTP connection." That's the whole NAME section. Short king behavior. πŸ’…


✨ SYNOPSIS ✨

here's the vibe in two lines, no notes:

my $rdns = $qp->connection->remote_host;
my $ip = $qp->connection->remote_ip;

look at that. immaculate. 🫢


🌸 DESCRIPTION 🌸

so this class is holding all the tea about one (1) individual SMTP connection. and when we say "a connection," we mean it lasts the entire lifetime of a TCP connection to the SMTP server. like, from the moment they pull up to the moment they leave. main character energy from start to finish. ✨

also, you HAVE to know about Qpsmtpd::Transaction β€” that's the other class, the one holding details about an individual SMTP transaction. and bestie, the difference matters:

  • a transaction lasts from "MAIL FROM" to the end of the "DATA" marker, or a "RSET" command β€” whichever one comes first, periodt
  • a connection lasts until the client disconnects 😌

so transaction = the conversation, connection = the whole relationship. iykyk. πŸ’–


πŸ”₯ API πŸ”₯

okay so these API docs are assuming you already HAVE a connection object. if you need to construct one from scratch, go read the source code, that's not our job here. and you can grab the connection object through the "Qpsmtpd" object's $qp->connection method. easy. 🌈

πŸŽ€ new ( )

instantiates a brand new Qpsmtpd::Connection object. fresh out the box, no cap. πŸ‘‘

πŸŽ€ start ( %args )

initializes the connection object using %args attribute data. giving it a little life, a little personality. 🌱

πŸŽ€ remote_host( )

the remote host that's connecting to the server, as looked up via reverse dns. your little detective work, slay. πŸ”

πŸŽ€ remote_ip( )

the remote IP address of the connecting host. the digits. the address. iconic. πŸ’»

πŸŽ€ remote_port( )

the remote port. that's it, that's the whole function. πŸ’«

πŸŽ€ remote_info( )

if your server does an ident lookup on the remote host, this is the identity of the remote client. only if you're doing the lookup though β€” otherwise don't expect anything. πŸ™ˆ

πŸŽ€ local_ip( )

the local ip. home sweet home. 🏠

πŸŽ€ local_port( )

the local port. matching set with the one above, obviously. πŸŽ€

πŸŽ€ hello( )

this one's either "helo" or "ehlo", depending on how the remote client greeted your server. which one? depends on their manners, honestly.

NOTE: this field is empty during the helo or ehlo hooks!! it only gets set after a successful return from those hooks. so don't come for it early, it's not ready yet. 😭

πŸŽ€ hello_host( )

the host name specified in the "HELO" or "EHLO" command.

NOTE: same deal bestie β€” this field is empty during the helo or ehlo hooks, and it's only set after a successful return from those hooks. do NOT be checking this too soon. πŸ’€

πŸŽ€ notes($key [, $value])

get or set a note on the connection. it's just a lil piece of data you wanna attach to the connection and read somewhere else later. for example, you can use this to pass data between plugins. it's giving ✨passing notes in class✨ but make it infrastructure. πŸ“

πŸŽ€ clone([%args])

returns a copy of the Qpsmtpd::Connection object. and that optional args parameter can contain:

  • no_reset (1|0) β€” if true, do not reset the original connection object. and heads up, the author has to care about that themselves: only the cloned connection object is reset at the end of the connection. so like, don't blame the module. πŸ™ˆ

πŸŽ€ relay_client( )

true if the client is allowed to relay messages. true = they're in. go off. πŸ”₯


and that's the whole page, bestie!! πŸ’– written up by the User Contributed Perl Documentation girlies, from perl v5.40.1, dated 2025-03-21 β€” big kisses, drink water, and remember: a connection lasts until the client disconnects. bye!! πŸ¦‹πŸŒΈπŸŽ€

πŸ“¦ where this page comes from