MboxPa...ertable(3pm)

πŸ“¦
version 0.55 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’Œ NAME πŸ’Œ

Mail::MboxParser::Mail::Convertable β€” bestie, this is the one that converts your mail for sending and stuff ✨


🌸 SYNOPSIS 🌸

use Mail::MboxParser;

[...]

# $msg is a Mail::MboxParser::Mail-object
my $mail = $msg->make_convertable;

$mail->delete_from_header('date', 'message-id');
$mail->replace_in_header('to', 'john.doe@foobar.com');
$mail->add_to_header( ['cc', 'john.does.brother@foobar.com'],
                      where => 'BEHIND' );
$mail->send('sendmail');

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: you've got an email object and you wanna glow it up so it can actually be sent somewhere. That's literally what this class does, no cap. It gives you the tools to convert an email object into something that could be sent via SMTP, NNTP, or just dumped out to a file or a filehandle. So the methods here mess with the structure of an email β€” adding and removing header-fields, MIME-parts, all of that β€” and they transform them into objects of related modules. It's giving ✨glow-up montage✨.

Right now, the only things on the menu are basic manipulation of the header plus sending through Mail::Mailer. More is coming soon β€” she's still growing πŸ’….

The most iconic part? This class works non-destructive. You first create a Convertable-object and do all your little edits on that, while the Mail-object you derived it from stays completely untouched. Main character energy: she doesn't take anyone down with her 🫢.

πŸ’– METHODS πŸ’–

  • delete_from_header(header-fields) β€” you hand her a list of header-field names and those fields get removed from the header. Say you wanna re-send a message: you could for example remove the cc-field, because otherwise the message would get carbon-copied to all the addresses chillin' in that cc-field. Bye bestie πŸ‘‹.
  • add_to_header(array-ref)
  • add_to_header(array-ref, where => 'BEFORE' | 'BEHIND') β€” add_to_header() takes a reference to a two-element list. The first element says which header-field to add, or which one to add to, and the second element is the data you wanna add. where decides whether it goes at the beginning or at the end of the header. If you don't say anything, it defaults to 'BEHIND'. So yes, back of the line by default πŸŽ€.
  • replace_in_header(header-field, new_data) β€” first element has got to be the header-field you're replacing, and the second argument is a string telling her what the new content of that header-field will be. Out with the old, in with the new πŸ’….
  • send(command, args) β€” this one is literally inherited from Mail::Internet. Commands can be:
    • "mail" β€” uses the UNIX-mail program
    • "sendmail" β€” uses a configured sendmail or a compatible MTA like exim
    • "smtp" β€” for using Net::SMTP
    • "test" β€” which will only display what would be sent, using /bin/echo

Any additional arguments get passed on to Mail::Mailer->new(), which is in fact what Mail::Internet->send() uses. Obsessed with the layering honestly.

For more details, see Mail::Mailer.


⭐ VERSION ⭐

This is version 0.55. She's vintage, she's thriving πŸ’œ.


Tassilo von Parseval <tassilo.von.parseval@rwth-aachen.de>

Copyright (c) 2001-2005 Tassilo von Parseval. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


🌈 SEE ALSO 🌈

Mail::Internet, Mail::Mailer


Okay that's the whole page bestie, you ate that πŸ“. This was MboxPa...ertable(3pm) from the User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-06-15 β€” iykyk πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from