Producing a [Mail List] Subject Line Identifier

classic Classic list List threaded Threaded
1 message Options
GregChapman GregChapman
Reply | Threaded
Open this post in threaded view
|

Producing a [Mail List] Subject Line Identifier

This post was updated on .
Nabble is capable of replicating the [identifier] prefix so often seen on emails from a mail list.

You need to edit two macros:

send_subscription_email
save_post_by_email

as follows:
<override_macro name="send_subscription_email" parameters="node_attr,text_part,html_part" requires="subscription">
    <n.set_local_subscription.this_subscription/>
    <n.set_local_node.node_attr/>
    <n.block.>
        <n.new_email.>
            <n.send>
                <to.local_subscription.user.user_email/>
                <to_name.local_subscription.user.name/>
                <from.local_subscription.user.reply_address_for.local_node/>
                <from_name><n.local_node.owner.name/> [via <n.root_node.subject/>]</from_name>
                <subject.>
                    [<n.local_node.get_app_node.subject/>] <n.local_node.subject/>
                </subject.>
                <text_part.text_part/>
                <html_part.html_part/>
                <set_headers_for.local_node/>
                <bounce_to.local_subscription.user.bounces_address/>
            </n.send>
        </n.new_email.>
    </n.block.>
</override_macro>
and
<override_macro name="save_post_by_email" requires="post_by_email" unindent="true">
    <n.set_var. name='prefix'>[<n.replied_to_node.get_app_node.subject/>]</n.set_var.>
    <n.set_new_post_subject.>
        <n.regex_replace_all. pattern="(Re:\s*)+" replacement="Re: ">
            <n.regex_replace_all. pattern="[n.regex_quote.var name='prefix'/]" replacement="">
                <n.new_post_subject/>
            </n.regex_replace_all.>                
        </n.regex_replace_all.>                
    </n.set_new_post_subject.>

    <n.overridden/>
</override_macro>

This code above appends the app name to the subject of outgoing emails and removes that text from incoming emails. So the forum will always look clean, but emails should have the desired [app-name] prefix.

Nabble's Hugo provided the code above and I have found no issues with it.

Greg