The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Email::Simple::Test::TraceHeaders - generate sample trace headers for testing

VERSION

version 0.091703

PERL VERSION

This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.)

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

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 <cpan@semiotic.systems>

CONTRIBUTOR

Ricardo Signes <rjbs@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 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.