man Qpsmtpd::Transaction () - single SMTP session transaction data
NAME
Qpsmtpd::Transaction - single SMTP session transaction data
SYNOPSIS
foreach my $recip ($transaction->recipients) { print "T", $recip->address, "\0"; }
DESCRIPTION
Qpsmtpd::Transaction maintains a single SMTP session's data, including the envelope details and the mail header and body.
The docs below cover using the CW$transaction object from within plugins rather than constructing a CWQpsmtpd::Transaction object, because the latter is done for you by qpsmtpd.
API
add_recipient($recipient)
This adds a new recipient (as in RCPT TO) to the envelope of the mail.
The CW$recipient is a CWQpsmtpd::Address object. See Qpsmtpd::Address for more details.
recipients( )
This returns a list of the current recipients in the envelope.
Each recipient returned is a CWQpsmtpd::Address object.
This method is also a setter. Pass in a list of recipients to change the recipient list to an entirely new list. Note that the recipients you pass in MUST be CWQpsmtpd::Address objects.
sender( [ ADDRESS ] )
Get or set the sender (MAIL FROM) address in the envelope.
The sender is a CWQpsmtpd::Address object.
header( [ HEADER ] )
Get or set the header of the email.
The header is a <Mail::Header> object, which gives you access to all the individual headers using a simple API. e.g.:
my $headers = $transaction->header(); my $msgid = $headers->get('Message-Id'); my $subject = $headers->get('Subject');Get or set a note on the transaction. This is a piece of data that you wish to attach to the transaction and read somewhere else. For example you can use this to pass data between plugins.
Note though that these notes will be lost when a transaction ends, for example on a CWRSET or after CWDATA completes, so you might want to use the notes field in the CWQpsmtpd::Connection object instead.
body_filename ( )
Returns the temporary filename used to store the message contents; useful for virus scanners so that an additional copy doesn't need to be made. Write data to the end of the email.
CW$data can be either a plain scalar, or a reference to a scalar.
body_size( )
Get the current size of the email.
body_resetpos( )
Resets the body filehandle to the start of the file (via CWseek()).
Use this function before every time you wish to process the entire body of the email to ensure that some other plugin has not moved the file pointer.
body_getline( )
Returns a single line of data from the body of the email.
SEE ALSO
Mail::Header, Qpsmtpd::Address, Qpsmtpd::Connection