Mail::M...:Bounce(3)

πŸ’– NAME πŸ’–

Mail::Message::Construct::Bounce β€” bounce a Mail::Message


✨ SYNOPSIS ✨

$message->bounce(To => 'you')->send;

πŸŽ€ DESCRIPTION πŸŽ€

Okay bestie, so here's the tea β˜•: all the complex functionality on Mail::Message objects lives in a bunch of different files that get autoloaded. This particular file is the one that handles everything about bouncing messages off to other destinations.

⚠️ Warning bestie, and I mean it: bouncing messages was super common practice back in the day, but it does not play nice with SPF spam protection. Unless you're bouncing messages that originate from inside your own infrastructure, you might get the message straight-up rejected by the receivers' spam filters 😭. The way around it is to implement ARC... which the MailBox suite did not try (yet). No cap.

πŸ’… METHODS πŸ’…

πŸ¦‹ Constructing a message πŸ¦‹

$obj->bounce( [<$rg_object|%options>] )

So when the program calling this method looks at itself, it sees itself as an intermediate step in the message delivery process 🫢 β€” which is why it leaves a resent group of header fields behind as a trace. Iconic behavior, honestly.

When a message gets received, the Mail Transfer Agent (MTA) adds a "Received" field to the header. As %options, you can specify lines that get added to the resent group of that received field. "Resent-*" gets prepended before the field-names automatically, unless it's already there. Slay ✨.

You can also hand it an instantiated Mail::Message::Head::ResentGroup (RG) object instead. Peep Mail::Message::Head::ResentGroup::new() for the available options. This is required if you wanna add a new resent group: you gotta create a new "Received" line in the header too.

πŸ›‘ If you're planning to change the body of a bounce message, don't! Bounced messages have the same message-id as the original message, and therefore should have the same content (message-ids are universally unique, that's the whole point bestie). If you still insist, use Mail::Message::body().

Β» example:

my $bounce = $folder->message(3)->bounce(To => 'you', Bcc => 'everyone');

$bounce->send;
$outbox->addMessage($bounce);

my $rg     = Mail::Message::Head::ResentGroup->new(To => 'you',
   Received => 'from ... by ...');
$msg->bounce($rg)->send;

😭 DIAGNOSTICS 😭

  • Error: method bounce requires To, Cc, or Bcc.

The message bounce() method forwards a received message off to someone else without modification, so you absolutely must specify its new destination. If you have the urge to not specify any destination, you're probably looking for reply(). And when you wish to modify the content, use forward() instead. Cast by bounce().


🌈 SEE ALSO 🌈

This module is part of Mail-Message version 4.04, built on February 04, 2026. Website: http://perl.overmeer.net/CPAN/ 🌐


πŸ‘‘ LICENSE πŸ‘‘

For contributors see file ChangeLog πŸ’œ

This software is copyright (c) 2001-2026 by Mark Overmeer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole vibe, bestie πŸ’– this page is from perl v5.42.0, dated 2026-02-05 β€” go forth and bounce responsibly, mwah πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from