DADA::App::FormatMessages
my $fm = DADA::App::FormatMessages->new(-List => $list); # The subject of the message is... $fm->Subject('This is the subject!'); # Use information you find in the headers $fm->use_header_info(1); # Use the list template $fm->use_list_template(1); # Use the email template. $fm->use_email_templates(1); # Consider this message as if it's from a discussion list $fm->treat_as_discussion_msg(1); my ($header_str, $body_str) = $fm->format_headers_and_body(-msg => $msg); # (... later on... use DADA::MAilingList::Settings; use DADA::Mail::Send; my $ls = DADA::MailingList::Settings->new(-List => $list); my $mh = DADA::Mail::Send->new($ls->get); $mh->send( $mh->return_headers($header_str), Body => $body_str, );
DADA::App::FormatMessages is used to get a email message ready for sending to your mailing list. Most of its magic is behind the scenes, and isn't something you have to worry about, but we'll go through some detail.
my $fm = DADA::App::FormatMessages->new(-List => $list);
my ($header_str, $body_str) = $fm->format_headers_and_body(-msg => $msg);
Given a string, $msg, returns two variables; $header_str, which will have all the headers and $body_str, that holds the body of your message.
Set the subject of a message
If set to a true value, will apply the list template to the HTML part of your message
If set to a true value, will apply your email templates to the HTML/PlainText parts of your message.
When set to a true value, will try the message as if it was from a discussion list.
If set to a true value, will inspect the headers of a message (for example, the From: line) to work with
$entity = $self->_fix_for_only_html_part($entity);
Changes the single part, HTML entity into a multipart/alternative message, with an auto plaintext version.
$entity = $self->_format_text($entity);
Given an MIME::Entity (may be multipart) will attempt to:
$entity = $self->_create_multipart_from_html($entity);
Recursively goes through a multipart entity, changing any non-attachment singlepart HTML message into a multipart/alternative message with an auto-generated PlainText version.
$entity = $self->_make_multipart($entity); Takes a single part entity and changes it to a multipart/alternative message, with an autogenerated PlainText version.
my $PlainText_var = $self->_create_plaintext_from_html($HTML_Ver);
Given a B<string>, simple converts the HTML to PlainText
$entity = $self->_format_headers($entity)
Given an entity, will do some transformations on the headers. It will:
my $subject = $self->_list_name_subject($list_name, $subject));
Appends, $list_name onto subject.
$data = $self->_parse_in_list_info(-data => $data, -type => (PlainText/HTML), ); Given a string, changes Dada Mail's pseudo tags into what they represent.
-type can be either PlainText or HTML
my $s_link = $self->_macro_tags(-type => 'subscribe' ); my $us_link = $self->_macro_tags(-type => 'unsubscribe');
Explode the various link pseudo tags into a form that will later be interpolated.
-type can be:
$content = $self->_apply_template(-data => $content, | |
-type => $entity->head->mime_type, | |
); |
Given a string in -data, applies the correct email mailing list template, depending on what -type is passed, this will be either the PlainText or HTML version.
$new_data = $self->_apply_list_template($new_data);
Given a string, will apply the List Template. The List Template is usually used for HTML screens that appear in your web browser.