NAME
Email::Simple::Test::TraceHeaders - generate sample trace headers for testing
VERSION
version 0.091701
METHODS
trace_headers
my $header_strings = Email::Simple::Test::TraceHeaders->trace_headers(\%arg);
This returns an arrayref of "Received" header strings.
At present, all headers are produced in Postfix style.
At present the only valid argument is hops
, which is an arrayref of hashrefs describing hops. Each hashref should have the following entries:
from_helo - the hostname given in the sending host's HELO
from_rdns - the hostname found by looking up the PTR for the sender's ip
from_ip - the IP addr of the sending host
by_name - the hostname of the receiving host
queue_id - the id of the mail queue entry created upon receipt
env_to - the recipient of the message (an email addr)
time - the timestamp on the header
At present, these are all required. In the future they may have more flexible semantics, and more formats for output of hops may be supported.
create_email
my $email_simple = Email::Simple::Test::TraceHeaders->create_email(
\%trace_arg
);
This creates and returns an Email::Simple message with trace headers created by "trace_headers"
.
HELPERS
Some routines can be exported to make it easier to set up trace headers.
You can get them all with:
use Email::Simple::Test::TraceHeaders -helpers;
prev
This helper gets a value from the previous hop. So, given these hops:
{ ..., by_name => 'mx.example.com', ... },
{ ..., from_rdns => prev('by_name'), ... },
...the second hop will have mx.example.com as its from_rdns
parameter.
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.