Ricardo SIGNES 😄


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


version 0.091702



  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.


  my $email_simple = Email::Simple::Test::TraceHeaders->create_email(

This creates and returns an Email::Simple message with trace headers created by "trace_headers".


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;


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.


Ricardo Signes <rjbs@cpan.org>


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