Login  Register

Re: [Mail List] Subject Line Identifier

Posted by Hugo <Nabble> on Nov 27, 2012; 5:57am
URL: https://support.nabble.com/Mail-List-Subject-Line-Identifier-tp7581972p7582055.html

Hi Greg, here is the complete solution. You have to override two macros:
<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 this one
<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 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. Please test this and let us know if you have questions, comments or concerns.